【发布时间】:2011-02-15 10:19:40
【问题描述】:
使用 WCF 服务(由 Silverlight 使用)时,我们经常会遇到错误,而这些错误并没有给我们太多帮助:
由于编译期间出现异常,无法激活服务“/ourservice.svc”。 异常消息是:对象引用未设置为对象的实例.. ---> System.NullReferenceException:对象引用未设置为对象的实例。 在 System.Web.Compilation.DiskBuildResultCache.CacheBuildResult(字符串 cacheKey,BuildResult 结果,Int64 hashCode,DateTime utcStart) 在 System.Web.Compilation.BuildManager.CacheBuildResultInternal(字符串 cacheKey,BuildResult 结果,Int64 hashCode,DateTime utcStart) 在 System.Web.Compilation.BuildManager.CompileWebFile(VirtualPath virtualPath) 在 System.Web.Compilation.BuildManager.GetVPathBuildResultInternal(VirtualPath virtualPath,布尔 noBuild,布尔 allowCrossApp,布尔 allowBuildInPrecompile) 在 System.Web.Compilation.BuildManager.GetVPathBuildResultWithNoAssert(HttpContext 上下文,VirtualPath virtualPath,布尔 noBuild,布尔 allowCrossApp,布尔 allowBuildInPrecompile)
每当我通过浏览器或使用 silverlight 客户端使用该服务时,该服务都能正常编译/运行。系统的 Silverlight 端报告这个同样无用的错误:
System.ServiceModel.CommunicationException:
[HttpWebRequest_WebException_RemoteServer]Arguments: NotFound
我设法找到的唯一线索可能是更改instancing behaviour,但我不确定我们为什么需要这样做,而且我也无法确定默认值是什么。
- 它托管在 Windows 2008 SP1 上
- 服务器位于负载平衡器后面
- web.config 中服务的超时时间为 5 分钟
- 最大对象大小为 50000000
- 服务有
AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)
任何建议都会很棒
更新
这是另一个症状 - Silverlight 客户端经常将此异常发送到我们的日志记录服务(写入事件日志 + 电子邮件)
There was an error saving the report - The error object contained errors
System.ServiceModel.CommunicationException: [HttpWebRequest_WebException_RemoteServer]
Arguments: NotFound
Debugging resource strings are unavailable. Often the key and arguments provide sufficient information to diagnose the problem. See http://go.microsoft.com/fwlink/?linkid=106663&Version=4.0.60129.0&File=System.Windows.dll&Key=HttpWebRequest_WebException_RemoteServer ---> System.Net.WebException: [HttpWebRequest_WebException_RemoteServer]
Arguments: NotFound
Debugging resource strings are unavailable. Often the key and arguments provide sufficient information to diagnose the problem. See http://go.microsoft.com/fwlink/?linkid=106663&Version=4.0.60129.0&File=System.Windows.dll&Key=HttpWebRequest_WebException_RemoteServer ---> System.Net.WebException: [HttpWebRequest_WebException_RemoteServer]
Arguments: NotFound
Debugging resource strings are unavailable. Often the key and arguments provide sufficient information to diagnose the problem. See http://go.microsoft.com/fwlink/?linkid=106663&Version=4.0.60129.0&File=System.Windows.dll&Key=HttpWebRequest_WebException_RemoteServer
at System.Net.Browser.BrowserHttpWebRequest.InternalEndGetResponse(IAsyncResult asyncResult)
at System.Net.Browser.BrowserHttpWebRequest.<>c__DisplayClass5.<EndGetResponse>b__4(Object sendState)
at System.Net.Browser.AsyncHelper.<>c__DisplayClass4.<BeginOnUI>b__1(Object sendState)
--- End of inner exception stack trace ---
at System.Net.Browser.AsyncHelper.BeginOnUI(SendOrPostCallback beginMethod, Object state)
at System.Net.Browser.BrowserHttpWebRequest.EndGetResponse(IAsyncResult asyncResult)
at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelAsyncRequest.CompleteGetResponse(IAsyncResult result)
--- End of inner exception stack trace ---
at System.ServiceModel.AsyncResult.End[TAsyncResult](IAsyncResult result)
at System.ServiceModel.Channels.ServiceChannel.EndCall(String action, Object[] outs, IAsyncResult result)
at System.ServiceModel.ClientBase`1.ChannelBase`1.EndInvoke(String methodName, Object[] args, IAsyncResult result)
at MyNamespaceSilverlight.Core.ReportServiceReference.ReportServiceClient.ReportServiceClientChannel.EndUpdateReport(IAsyncResult result)
at MyNamespaceSilverlight.Core.ReportServiceReference.ReportServiceClient.MyNamespaceSilverlight.Core.ReportServiceReference.IReportService.EndUpdateReport(IAsyncResult result)
at MyNamespaceSilverlight.Core.ReportServiceReference.ReportServiceClient.OnEndUpdateReport(IAsyncResult result)
at System.ServiceModel.ClientBase`1.OnAsyncCallCompleted(IAsyncResult result)
【问题讨论】:
-
这是完整的堆栈跟踪吗?感觉很短。
标签: wcf