我在我的服务器上运行了一个 MVC4 Web 应用程序,并且在同一目录中有一个 ADO.NET 数据服务 (OData) 服务。
一切正常,我的视图可以从客户端使用我的 OData 服务,但所有 DELETE 请求都失败并出现错误 500:
Exception type: InvalidOperationException
Exception message: The view 'Northwind.svc/Products(90)' or its master was not found or no view engine supports the searched locations. The following locations were searched:
~/Views/Home/Northwind.svc/Products(90).aspx
~/Views/Home/Northwind.svc/Products(90).ascx
~/Views/Shared/Northwind.svc/Products(90).aspx
~/Views/Shared/Northwind.svc/Products(90).ascx
~/Views/Home/Northwind.svc/Products(90).cshtml
~/Views/Home/Northwind.svc/Products(90).vbhtml
~/Views/Shared/Northwind.svc/Products(90).cshtml
~/Views/Shared/Northwind.svc/Products(90).vbhtml
at System.Web.Mvc.ViewResult.FindView(ControllerContext context)
at System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext context)
at System.Web.Mvc.ControllerActionInvoker.<>c__DisplayClass1a.<InvokeActionResultWithFilters>b__17()
at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation)
at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext controllerContext, IList`1 filters, ActionResult actionResult)
at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass25.<BeginInvokeAction>b__22(IAsyncResult asyncResult)
at System.Web.Mvc.Controller.<>c__DisplayClass1d.<BeginExecuteCore>b__18(IAsyncResult asyncResult)
at System.Web.Mvc.Async.AsyncResultWrapper.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar)
at System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult)
at System.Web.Mvc.Async.AsyncResultWrapper.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar)
at System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult)
at System.Web.Mvc.MvcHandler.<>c__DisplayClass8.<BeginProcessRequest>b__3(IAsyncResult asyncResult)
at System.Web.Mvc.Async.AsyncResultWrapper.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar)
at System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult)
at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
请求:
Request URL:http://{myhost}/Northwind.svc/Products(90)
Request Method:DELETE
Accept:application/atomsvc+xml;q=0.8, application/json;odata=verbose;q=0.5, */*;q=0.1
Accept-Encoding:gzip,deflate,sdch
Accept-Language:en-US,en;q=0.8,hu;q=0.6
Cache-Control:no-cache
Connection:keep-alive
Host: {myhost}
MaxDataServiceVersion:2.0
Origin:http://{myhost}
有没有人遇到过同样的问题?我很欣赏所有的想法。