一段时间不活动后,IIS 中的 WebService 出现异常
我的项目中有两个网络服务。 SecondService
通过 Spring.NET 使用 FirstService
。
以下是配置文件的片段:
<object id="SecondServiceClass" type="SecondService.SecondServiceClass">
<property name="FirstService" ref="FirstServiceClass"/>
</object>
<object id="SecondService" type="Spring.Web.Services.WebServiceExporter, Spring.Web">
<property name="TargetName" value="SecondServiceClass"/>
</object>
<object id="baseClientService" abstract="true">
<property name="ProductTemplate">
<object>
<property name="Timeout" value="10000" />
<!-- 10s -->
</object>
</property>
</object>
<object id="FirstServiceClass" type="Spring.Web.Services.WebServiceProxyFactory, Spring.Services" parent="baseClientService">
<property name="ServiceUri" value="http://localhost/FirstService/FirstService.asmx"/>
<property name="ServiceInterface" value="Services.First.IFirstService, ServiceLayer"/>
</object>
运行一段时间后(大约 2-10 小时),我从 SecondService
收到此异常:
异常类型:ConfigurationErrorsException
异常消息:创建上下文“/secondservice”时出错:无法从字符串值“SecondService.SecondService”加载类型。
在引发异常之前,服务可能会空闲一段时间。
I have two web-services in my project. SecondService
uses FirstService
through Spring.NET.
Here is a fragment of configuration file:
<object id="SecondServiceClass" type="SecondService.SecondServiceClass">
<property name="FirstService" ref="FirstServiceClass"/>
</object>
<object id="SecondService" type="Spring.Web.Services.WebServiceExporter, Spring.Web">
<property name="TargetName" value="SecondServiceClass"/>
</object>
<object id="baseClientService" abstract="true">
<property name="ProductTemplate">
<object>
<property name="Timeout" value="10000" />
<!-- 10s -->
</object>
</property>
</object>
<object id="FirstServiceClass" type="Spring.Web.Services.WebServiceProxyFactory, Spring.Services" parent="baseClientService">
<property name="ServiceUri" value="http://localhost/FirstService/FirstService.asmx"/>
<property name="ServiceInterface" value="Services.First.IFirstService, ServiceLayer"/>
</object>
After some time running (about 2-10 hrs) I get this exception from SecondService
:
Exception type: ConfigurationErrorsException
Exception message: Error creating context '/secondservice': Could not load type from string value 'SecondService.SecondService'.
The services are possibly idle for some time before the exception is raised.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
为您的 Web 服务编写一个 ping 方法(一种不返回任何内容的简单方法)并定期调用它!
Write a ping method (a simple method retuning nothing) for your webservice and call it periodically!