WCF服务在一段时间后自行消亡
我面临一个与托管WCF服务相关的特殊问题(.NET Framework 4、IIS 7、Windows 2008标准SP2) 在我部署该服务后,它可以正常工作一段时间,并通过抛出一个“未找到文件”异常自行终止。例外情况详情如下所示 该应用程序托管在IIS7中,有一个指向.NET Framework 4版本的特定应用程序池。我已经使用FusionLog找到了更多关于丢失的组件的信息—不走运。但是,如果我从托管服务器中删除所有程序集,并从生成文件夹中再次复制它,它将重新开始工作,而不会出现任何问题。我无法解释这种行为,因此我进行了大量的搜索/尝试以找到答案。为了提供更多信息,该服务是一个本地程序集,我使用企业库进行异常处理和日志记录。WCF使用httpBinding为我们提供服务。这些程序集是调试生成的。请帮忙WCF服务在一段时间后自行消亡,wcf,hosting,Wcf,Hosting,我面临一个与托管WCF服务相关的特殊问题(.NET Framework 4、IIS 7、Windows 2008标准SP2) 在我部署该服务后,它可以正常工作一段时间,并通过抛出一个“未找到文件”异常自行终止。例外情况详情如下所示 该应用程序托管在IIS7中,有一个指向.NET Framework 4版本的特定应用程序池。我已经使用FusionLog找到了更多关于丢失的组件的信息—不走运。但是,如果我从托管服务器中删除所有程序集,并从生成文件夹中再次复制它,它将重新开始工作,而不会出现任何问题。
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<configSections>
------
<!-- Begin .......Exception Handling Configuration-->
<!-- End .........Exception Handling configuration-->
<!-- Start .............Logging Configuration-->
<!--End............ Logging Configuration-->
<system.web>
<compilation debug="true" targetFramework="4.0" />
<identity impersonate="true" />
</system.web>
<system.webServer>
<validation validateIntegratedModeConfiguration="false" />
<defaultDocument>
<files>
<add value="Service.svc" />
</files>
</defaultDocument>
</system.webServer>
<!-- Start WCF ................Settings-->
<system.serviceModel>
<diagnostics>
<messageLogging logEntireMessage="true" logMessagesAtServiceLevel="true" />
<endToEndTracing propagateActivity="true" activityTracing="true" messageFlowTracing="true" />
</diagnostics>
<!-- Begin..Included for Switching off Security-->
<bindings>
<basicHttpBinding>
<binding name="httpBindingConfig" closeTimeout="24.01:00:00" openTimeout="24.01:00:00" receiveTimeout="24.10:00:00" sendTimeout="24.01:00:00" />
</basicHttpBinding>
</bindings>
<!-- End ..Included for Switching off Security-->
<services>
<service name="Service">
<endpoint binding="mexTcpBinding" bindingConfiguration="" name="EndPointMex" contract="ICommunicatorService" />
<endpoint address="http://<>/Service.svc" binding="basicHttpBinding" bindingConfiguration="" name="EndPointHttp" contract="Reflections.IService" />
<host>
<timeouts closeTimeout="24.00:10:00" openTimeout="24.01:00:00" />
</host>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior>
<!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
<serviceMetadata httpGetEnabled="true" />
<!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information -->
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
</system.serviceModel>
<!-- End WCF ................Settings-->
<system.webServer>
<modules runAllManagedModulesForAllRequests="true" />
</system.webServer>
</configuration>
融合日志中的错误
*** Assembly Binder Log Entry (7/22/2011 @ 10:34:51 AM) ***
The operation failed.
Bind result: hr = 0x80070002. The system cannot find the file specified.
Assembly manager loaded from: C:\Windows\Microsoft.NET\Framework\v4.0.30319\clr.dll
Running under executable c:\windows\system32\inetsrv\w3wp.exe
--- A detailed error log follows.
=== Pre-bind state information ===
LOG: User = NT AUTHORITY\NETWORK SERVICE
LOG: DisplayName = Reflections.Service, Version=1.0.0.0, Culture=en-US, PublicKeyToken=fb2997440781f12e
(Fully-specified)
LOG: Appbase = file://path/
LOG: Initial PrivatePath = \\path\bin
LOG: Dynamic Base = C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\b44c783a
LOG: Cache Base = C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\b44c783a
LOG: AppName = 34485861
Calling assembly : (Unknown).
===
LOG: Start binding of native image Reflections.Service, Version=1.0.0.0, Culture=en-US, PublicKeyToken=fb2997440781f12e.
WRN: No matching native image found.
这里讨论了一个类似的问题,但找不到答案是否可能找不到的文件是一个麻烦,而您只是遇到了一个不活动超时?我记得当我编写第一个WCF服务时,我没有意识到超时设置默认为相当短的时间,比如几分钟。我想你可以把它们设置得很长(比如24天)
在我的应用程序配置中,在我的分区之后的分区中,我有:
<system.serviceModel>
<bindings>
<netTcpBinding>
<binding name="tcp_unsecured" receiveTimeout="infinite" sendTimeout="00:00:30">
<security mode="None">
</security>
</binding>
</netTcpBinding>
</bindings>
托德-谢谢你抽出时间,我真的很感谢你的帮助。你是指首先让我说我不是专家,我只有自我托管和windows服务托管。我将在我的app.config中发布我更改过的部分,但最终我的服务由于其他原因被应用程序通过计时器ping到,因此始终无法超时。我不确定我是否已经确定了超时设置。但是你可以在这里进行更好的搜索,现在你知道了它们的存在。汤姆-我仍然有这个问题,建议的设置没有帮助。我的live服务在15 mts后停止。我唯一能建议的是尝试确认它是超时问题。您可以启动计时器,让它每分钟向您的服务发送一次请求。如果它仍然死了,那就不是超时错误。我已经编辑了我的原始问题,将web.config文件包括在内。就投票而言,我没有足够的分数。Appologies.it正在查找名为Reflections.Service的文件。这是容纳您的服务的程序集的名称吗?@Anil-您可以在hadrware环境中提供任何其他详细信息吗?这里有硬件集群吗?此外,您不应该这样做,但您是否考虑过将服务创建为WCF库并手动将其托管在IIS中?这将允许你把你的服务库扔到GAC中——无法想象它会从那里被删除!
*** Assembly Binder Log Entry (7/22/2011 @ 10:34:51 AM) ***
The operation failed.
Bind result: hr = 0x80070002. The system cannot find the file specified.
Assembly manager loaded from: C:\Windows\Microsoft.NET\Framework\v4.0.30319\clr.dll
Running under executable c:\windows\system32\inetsrv\w3wp.exe
--- A detailed error log follows.
=== Pre-bind state information ===
LOG: User = NT AUTHORITY\NETWORK SERVICE
LOG: DisplayName = Reflections.Service, Version=1.0.0.0, Culture=en-US, PublicKeyToken=fb2997440781f12e
(Fully-specified)
LOG: Appbase = file://path/
LOG: Initial PrivatePath = \\path\bin
LOG: Dynamic Base = C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\b44c783a
LOG: Cache Base = C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\b44c783a
LOG: AppName = 34485861
Calling assembly : (Unknown).
===
LOG: Start binding of native image Reflections.Service, Version=1.0.0.0, Culture=en-US, PublicKeyToken=fb2997440781f12e.
WRN: No matching native image found.
<system.serviceModel>
<bindings>
<netTcpBinding>
<binding name="tcp_unsecured" receiveTimeout="infinite" sendTimeout="00:00:30">
<security mode="None">
</security>
</binding>
</netTcpBinding>
</bindings>
public DspServiceMediator( String serviceAddress)
{
EndpointAddress end_point = new EndpointAddress(serviceAddress);
NetTcpBinding new_tcp = new NetTcpBinding(SecurityMode.None)
{ReceiveTimeout = TimeSpan.MaxValue,
SendTimeout = new TimeSpan(0, 0, 30)
};
_dspClient = new DspServiceClient(new_tcp, end_point);
}