我有WCF DataService,当通过浏览器直接查询时,效果很好。然而,当从Visual Studio2010运行时,我试图查询并绑定到网格,它抛出一个DataServiceQueryException,告诉我“资源未找到”,一个404错误。这真的很奇怪。有什么想法吗?
发布于 2010-12-08 17:49:30
你在自托管服务吗?当你测试这个服务时,你是在VS开发服务器上运行它吗?
我的想法是,当您尝试添加服务引用时,服务可能并未实际运行。
发布于 2010-12-16 22:22:13
这仍然存在问题。服务驻留在客户端中。下面是完整的错误:
[DataServiceClientException:找不到该资源。body {font-family:"Verdana";font-weight:normal;font-size:.7em;color:black;} p {font-family:"Verdana";font-weight:bold;color:black;margin-top:-5px} b font-family:"Verdana";font-weight:normal;font-size:18pt;-5px} .7em;color:black{ H1color:red } H2 { font-family:"Verdana";font-weight:normal;font-size:14pt;color:maroon } pre {font-family:"Lucida控制台“;font-size:.9em} .marker { font-weight: bold;color:黑色;text-decoration: none;} .version {color:灰色;} .error {边距-底部: 10px;} .expandable {text-family:下划线;font-weight: bold;颜色:海军;光标:手形;}
<body bgcolor="white">
<span><H1>Server Error in '/' Application.<hr width=100% size=1 color=silver></H1>
<h2> <i>The resource cannot be found.</i> </h2></span>
<font face="Arial, Helvetica, Geneva, SunSans-Regular, sans-serif ">
<b> Description: </b>HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable. Please review the following URL and make sure that it is spelled correctly.
<br><br>
<b> Requested URL: </b>/TripReport.svc/OPRs<br><br>
<hr width=100% size=1 color=silver>
<b>Version Information:</b> Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.1
</font>
</body>] System.Data.Services.Client.QueryResult.Execute() +475306 System.Data.Services.Client.DataServiceRequest.Execute(DataServiceContext context,QueryComponents queryComponents) +137
DataServiceQueryException:处理此请求时出错。System.Data.Services.Client.DataServiceRequest.Execute(DataServiceContext上下文,管理员集合) +396 System.Data.Services.Client.DataServiceQuery1.Execute() +77 System.Data.Services.Client.DataServiceQuery1.GetEnumerator() +13 System.Collections.Generic.List1..ctor(IEnumerable1集合) +315 TripReport.Controllers.GeneralControllers.GetDirectorates() (IEnumerable`1源) +58 2010\Projects\TripReport\Common\Controllers\GeneralControllers.cs:14在C:\Users\ QueryComponents \Documents\Visual Studio 2010\Projects\TripReport\Common\Controllers\GeneralControllers.cs:14 TripReport.Controls.CreateTrip.Page_Load(Object queryComponents中,e)在C:\Users\administrator\Documents\Visual Studio 2010\Projects\TripReport\Controls\CreateTrip.ascx.cs:16 System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp,Object o,Object t,EventArgs e) +14 System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object EventArgs,EventArgs e) +35 System.Web.UI.Control.OnLoad(EventArgs e) +91 System.Web.UI.Control.LoadRecursive() +74 System.Web.UI.Control.LoadRecursive() +146 System.Web.UI.Control.LoadRecursive() +146 System.Web.UI.Page.ProcessRequestMain(布尔型includeStagesBeforeAsyncPoint,布尔includeStagesAfterAsyncPoint) +2207
https://stackoverflow.com/questions/4374749
复制相似问题