(아래 해결 방법) 기존 ASP .Net MVC 응용 프로그램에 WCF 웹 서비스를 추가 할 때 앱 시작에서 웹 서비스 경로를 등록 할 때 내 로그인 양식에서 웹 서비스를 통해 로그인 토큰을 라우팅하려고합니다.
내 웹 서비스에 경로를 등록하지 않으면 (아래와 같이) 이것이 의미 합니다.
Protected Sub Application_Start()
...
RouteTable.Routes.Add(New ServiceRoute("MyWebServiceName", New WebServiceHostFactory(), GetType(MyWebServiceName)))
RouteConfig.RegisterRoutes(RouteTable.Routes)
...
End Sub
다음과 같이 내 로그인 경로를 올바르게 다시 지정합니다. http://localhost:49322/Account/Login?ReturnUrl=%2F
그러나 웹 서비스 경로를 등록 하면 다음과 같이 로그인 경로를 변경하려고 시도합니다.http://localhost:49322/EISFacialWebService?action=Login&controller=Account&ReturnUrl=%2F
어떤 아이디어 ???
해결 :
리팩토링으로 해결했습니다.
RouteTable.Routes.Add(new ServiceRoute("MyService.svc", new ServiceHostFactory(), typeof(MyService)))
로부터 Globals.asax
파일
에 ~/App_Start/RouteConfig.vb
파일 ...
routes.IgnoreRoute("{resource}.svc/{*pathInfo}")
)Public Sub RegisterRoutes(ByVal routes As RouteCollection)
routes.IgnoreRoute("{resource}.axd/{*pathInfo}")
/* [ PART 1 ] */
routes.IgnoreRoute("{resource}.svc/{*pathInfo}")
routes.MapRoute(
name:="Default",
url:="{controller}/{action}/{id}",
defaults:=New With {.controller = "Home", .action = "Inbox", .id = UrlParameter.Optional}
)
/* [ PART 2 ] */
routes.Add(New ServiceRoute("MyService.svc", New WebServiceHostFactory(), GetType(MyService)))
End Sub
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다