我想/_vti_bin/Lists.asmx路径添加到我的ASP.NET MVC 2 Web应用程序。路径_vti_bin/Lists.asmx添加到ASP.NET MVC 2的Web应用程序
我注册的路线如下:
routes.IgnoreRoute("{resource}.asmx/{*pathInfo}");
routes.Add(new Route("_vti_bin/Lists.asmx", new ListsHandler()));
其中ListHandler被定义为:
public sealed class ListsHandler : IRouteHandler
{
#region IRouteHandler Members
public IHttpHandler GetHttpHandler(RequestContext requestContext)
{
throw new NotImplementedException();
}
#endregion
}
但是当我开始MVC应用程序,并尝试导航到http://localhost:8888/_vti_bin/Lists.asmx,我得到一个HTTP 404错误,而不是引发的异常。
这甚至可能在MVC?我是否需要将Lists.asmx ASPX Web服务文件添加到我的项目的特定位置(我无法在Visual Studio项目中创建_vti_bin文件夹)?
更新:达林的回复启用http://localhost:8888/_vti_bin/Lists.asmx现在可以工作(唯一的区别是路由定义的顺序)。但是现在,请求默认MVC 2项目站点的“关于”页面会导致请求http://localhost:8888/_vti_bin/Lists.asmx?action=About&controller=Home,而不是家庭控制器!
显然路线的定义顺序是重要的。
'_vti_bin'文件夹是否是SharePoint约定?我记得看到使用SharePoint Web服务的命名约定的文件夹? (我可能完全错了) – Ahmad 2010-04-22 06:04:18
是的,它被SharePoint使用,我实际上试图模仿我的项目中的SharePoint服务接口。 – 2010-04-22 17:02:08