2016-09-27 2 views
-1

내가 고르과 Angular2 응용 프로그램과 ASP.NET 웹 API를이 전 세계적으로 활성화됩니다 (로그인 모델을 복용 enter image description hereCORS 응답이 때 엔드 포인트가 인수

과 게시물 컨트롤러, 이메일 및 문자열로 암호) enter image description here

와 클라이언트의 요청 : enter image description here

내가 매개 변수를 비워두면, 난 내 프론트 엔드에서 호출 아무런 문제가 없지만, 내가 loginmodel을 필요로두고, 내가 얻을 f 따르게 : enter image description here 와 요청이 될 수있는 방법을 enter image description here

사람이 말할 수 있습니까? 적어도 그것을 해결하는 방법은 아닙니다.

답변

0

나는 설명 할 수는 없지만 효과가있다. 내 WebApiConfig에서

  var cors = new EnableCorsAttribute("*", "*", "*"); 
      config.EnableCors(cors); 

을 대신 내 Web.config의에 다음과 같은 추가 : 나는 제거

<system.webServer> 
<httpProtocol> 
    <customHeaders> 
    <!-- This enables your CORS Requests to be accepted. --> 
    <add name="Access-Control-Allow-Origin" value="*" /> 
    <add name="Access-Control-Allow-Headers" value="Content-Type" /> 
    <add name="Access-Control-Allow-Credentials" value="true" /> 
    <add name="Access-Control-Allow-Methods" value="GET, POST, OPTIONS" /> 
    </customHeaders> 
</httpProtocol> 

의 I는 beginnig에서이 작업을 수행하지 않은 이유는 이유였다을 나의 웹 API (2) system.webserver를 가지고 있지 않았고 system.web을 가지고 있었고 둘 다 가질 수 있다는 것을 알지 못했습니다. 누구나 이해할 수 있다면

관련 문제