【发布时间】:2012-05-18 03:09:58
【问题描述】:
我在 MVC3 Web 应用程序中托管 WCF 服务。我有一个带有 UriTemplate 的 WebGet 属性的方法设置。当 UriTemplate 包含句点时,我会从 Web 服务器收到 404 响应。
[OperationContract, WebGet(UriTemplate = "DoSomething")]
Stream DoWork();
http://localhost/Services/Service1.svc/DoSomething - Works Correctly
[OperationContract, WebGet(UriTemplate = "dummyfile.xml")]
Stream DoWork();
http://localhost/Services/Service1.svc/dummyfile.xml - Returns a 404 error
我猜这与路线有关,但我不确定。我现在设置的路线是:
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.IgnoreRoute("{resource}.svc/{*pathInfo}");
routes.MapRoute( "Default", "{controller}/{action}/{id}", new { controller = "Home", action = "Index", id = UrlParameter.Optional });
谁能提供一些关于如何使用带有句点的 URITemplate 在 MVC3 应用程序中托管 WCF 服务的见解?
【问题讨论】:
-
菲尔哈克有the answer
-
@EdSF 为什么不添加该评论作为答案,以便他同意您的意见:)
标签: c# asp.net wcf asp.net-mvc-3