NotFound 错误和编译失败的问题 [英] Problems with NotFound errors and compilation failures

查看:25
本文介绍了NotFound 错误和编译失败的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用 WCF 服务(由 Silverlight 使用)时,我们经常会遇到错误,而这些服务并没有给我们带来太多的进展:

<块引用><前>由于编译期间出现异常,无法激活服务/ourservice.svc".异常消息是:对象引用未设置为对象的实例.. --->System.NullReferenceException:未将对象引用设置为对象的实例.在 System.Web.Compilation.DiskBuildResultCache.CacheBuildResult(String cacheKey, BuildResult result, Int64 hashCode, DateTime utcStart)在 System.Web.Compilation.BuildManager.CacheBuildResultInternal(String cacheKey, BuildResult result, Int64 hashCode, DateTime utcStart)在 System.Web.Compilation.BuildManager.CompileWebFile(VirtualPath virtualPath)在 System.Web.Compilation.BuildManager.GetVPathBuildResultInternal(VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile)在 System.Web.Compilation.BuildManager.GetVPathBuildResultWithNoAssert(HttpContext context, VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile)

每当我通过浏览器或使用 Silverlight 客户端使用该服务时,它都能正常编译/运行.系统的 Silverlight 端也报告了这个同样无益的错误:

System.ServiceModel.CommunicationException:[HttpWebRequest_WebException_RemoteServer]参数:未找到

我设法找到的唯一线索可能是改变了实例化行为 但我不知道为什么我们需要这样做,而且我也不知道默认值是什么.

  • 它托管在 Windows 2008 SP1 上
  • 服务器在负载均衡器后面
  • web.config 中服务的超时为 5 分钟
  • 最大对象大小为 50000000
  • 服务具有 AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)

任何建议都会很棒

更新

这是另一个症状 - Silverlight 客户端经常将此异常发送到我们的日志记录服务(写入事件日志 + 电子邮件)

保存报告时出错 - 错误对象包含错误System.ServiceModel.CommunicationException: [HttpWebRequest_WebException_RemoteServer]参数:未找到调试资源字符串不可用.通常,键和参数提供了足够的信息来诊断问题.参见 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]参数:未找到调试资源字符串不可用.通常,键和参数提供了足够的信息来诊断问题.参见 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]参数:未找到调试资源字符串不可用.通常,键和参数提供了足够的信息来诊断问题.参见 http://go.microsoft.com/fwlink/?linkid=106663&Version=4.0.60129.0&File=System.Windows.dll&Key=HttpWebRequest_WebException_RemoteServer在 System.Net.Browser.BrowserHttpWebRequest.InternalEndGetResponse(IAsyncResult asyncResult)在 System.Net.Browser.BrowserHttpWebRequest.<>c__DisplayClass5.&l​​t;EndGetResponse>b__4(Object sendState)在 System.Net.Browser.AsyncHelper.<>c__DisplayClass4.<BeginOnUI>b__1(Object sendState)--- 内部异常堆栈跟踪结束 ---在 System.Net.Browser.AsyncHelper.BeginOnUI(SendOrPostCallback beginMethod, Object state)在 System.Net.Browser.BrowserHttpWebRequest.EndGetResponse(IAsyncResult asyncResult)在 System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelAsyncRequest.CompleteGetResponse(IAsyncResult 结果)--- 内部异常堆栈跟踪结束 ---在 System.ServiceModel.AsyncResult.End[TAsyncResult](IAsyncResult 结果)在 System.ServiceModel.Channels.ServiceChannel.EndCall(String action, Object[] outs, IAsyncResult result)在 System.ServiceModel.ClientBase`1.ChannelBase`1.EndInvoke(String methodName, Object[] args, IAsyncResult result)在 MyNamespaceSilverlight.Core.ReportServiceReference.ReportServiceClient.ReportServiceClientChannel.EndUpdateReport(IAsyncResult 结果)在 MyNamespaceSilverlight.Core.ReportServiceReference.ReportServiceClient.MyNamespaceSilverlight.Core.ReportServiceReference.IReportService.EndUpdateReport(IAsyncResult 结果)在 MyNamespaceSilverlight.Core.ReportServiceReference.ReportServiceClient.OnEndUpdateReport(IAsyncResult 结果)在 System.ServiceModel.ClientBase`1.OnAsyncCallCompleted(IAsyncResult 结果)

解决方案

服务中是否有任何内容修改了 \bin 目录的内容?当托管在 ASP.NET 下时,ASP.NET 运行时将监视 \bin 目录中的任何更改,当看到更改时,它将尝试重新初始化应用程序,以便它获取可能发生的任何更改.

作为服务正常操作的一部分,您不应将任何内容写入 \bin 目录.通常这是日志文件被配置为写入 \bin 目录而不是它们自己的特定目录的问题.如果由于某种原因无法将日志文件写入应用程序目录根目录之外的某个位置,只需将它们写入 \logs 子目录并配置 ASP.NET 以阻止对该目录的所有访问,如下所示:

<system.web><授权><deny users="*"/></授权></system.web></位置>

We're getting errors every so often with a WCF service (consumed by Silverlight) that don't give us much to go on:

The service '/ourservice.svc' cannot be activated due to an exception during compilation.  
The exception message is: Object reference not set to an instance of an object.. ---> 
System.NullReferenceException: Object reference not set to an instance of an object.
at System.Web.Compilation.DiskBuildResultCache.CacheBuildResult(String cacheKey, BuildResult result, Int64 hashCode, DateTime utcStart)
   at System.Web.Compilation.BuildManager.CacheBuildResultInternal(String cacheKey, BuildResult result, Int64 hashCode, DateTime utcStart)
   at System.Web.Compilation.BuildManager.CompileWebFile(VirtualPath virtualPath)
   at System.Web.Compilation.BuildManager.GetVPathBuildResultInternal(VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile)
   at System.Web.Compilation.BuildManager.GetVPathBuildResultWithNoAssert(HttpContext context, VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile)

The service compiles/runs fine whenever I use it via the browser or using the silverlight client. The Silverlight side of the system reports this also equally un-helpful error:

System.ServiceModel.CommunicationException: 
[HttpWebRequest_WebException_RemoteServer]Arguments: NotFound

The only lead I've managed to find is possibly changing the instancing behaviour but I'm not sure why we would need to do that, and I can't tell what the default is anyway.

  • It's hosted on Windows 2008 SP1
  • The server is behind a load balancer
  • The timeouts in the web.config for the service are 5 minutes
  • The maximum object size is 50000000
  • The services have AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)

Any suggestions would be great

Update

This is another symptom - the Silverlight client frequently sends this exception to our logging service (which writes to the event log + emails)

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)

解决方案

Is anything in the service modifying the contents of the \bin directory? When hosting under ASP.NET, the ASP.NET runtime will monitor the \bin directory for any changes and, when a change is seen, it will attempt to reinitialize the application so that it picks up whatever changes there might have been.

You should not have anything writing to the \bin directory as part of your service's normal operation. Usually this is a problem with log files being configured to write to the \bin directory rather than a specific directory of their own. If you are unable to write the log files someplace outside the root of your application directory for whatever reason, just write them into a \logs sub-directory and configure ASP.NET to block all access to that directory like so:

<location path="logs">
    <system.web>
        <authorization>
            <deny users="*" />
        </authorization>
    </system.web>
</location>

这篇关于NotFound 错误和编译失败的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆