如果我不在 IIS 下来回切换 asp.net 版本,Webservice 调用会失败
我有最奇怪的问题。
我已经部署了一个 asp.net mvc web 应用程序(IIS 6 下的虚拟目录,在其他 net 4.0 应用程序共享的应用程序池下运行)。在 web 应用程序中,我有一个调用 MS Reporting Services web 服务的程序集。奇怪的是,如果我暂时不要使用 webb 应用程序,然后进入我的网站,以便调用 web 服务我收到以下异常:
“HTTP 状态 503:服务不可用”
首先,我认为这与服务确实不可用有关但在尝试了来自不同计算机(和控制台应用程序)的所有内容后,情况并非如此。
为了缩短错误搜索的时间:我打开了虚拟目录的属性窗口,选择了 ASP.NET 选项卡,将下拉框中的值更改为 2.0...并且不单击“应用”或“确定”,将值更改回 4.0,然后单击“应用”,然后单击“确定”,瞧,服务调用再次起作用。
完成此过程后,我注意到 Windows 事件日志中出现以下日志:
“正在重新启动 W3SVC”,源为“ASP.NET 2.0.50727.0”。为什么,我只选择了2.0框架,然后在点击应用按钮之前切换回4.0。 asp.net 版本仍应为 4.0,如果重新启动任何服务,则该事件的源应为 4.0。
如果我等待一段时间,问题再次出现,我必须再次执行相同的过程。
有谁知道为什么会发生这种情况?
更新:发现该问题是由于 DNS 查找问题造成的。我知道这听起来很奇怪,但这是真的。如果我们在调用 Web 服务时使用 ipadress,问题就解决了...
/最诚挚的问候 Vinblad
I have the strangest problem.
I've deployed a asp.net mvc webapplication (virtual directory under IIS 6 running under a application pool shared by other net 4.0 applications. In the webapplication I have an assembly that calls the MS Reporting Services webservice. The strange part is, if I dont use the webbapplication for a while and then go into my website so that the call is made to the webservice I get the following exception:
"HTTP status 503: Service Unavailable"
First I thought this had something to do with the service really beeing unavailable but after trying everything from different machines (and console applications) this was not the case.
To make a looong error search short: I opened up the properties window for the virtual directory selected the ASP.NET tab, changed the value in the dropdownbox to 2.0.. and without clicking apply or ok, change the value back to 4.0 and then clicked "Apply" and then "OK", and voila the service call worked again.
After this procedure is done I've noticed the following log in windows eventlog:
"Restarting W3SVC" with source "ASP.NET 2.0.50727.0". Why is that, I've only choosen the 2.0 framework, and then switched back to 4.0 before hitting the apply button. The asp.net version should still be 4.0 and if any service is restared the source of that event should be 4.0.
If I wait for a while the problem occurs again and I have to do the same procedure again.
Does any one have any idea as to why this happens?
Update: The problem was found to be the result of problems doing a DNS lookup. I know it sounds strange but it's true. If we use the ipadress when calling the webservice the problem was solved...
/Best regards Vinblad
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您的应用程序池是否正在重置?它的超时时间是多少我认为默认情况下大约是 20 分钟。通过更改 .net 版本,您将回收应用程序池,使其重新启动。
Is your application pool being reset? What's its time out I think its about 20 mins by default. By changing the .net version you are recylcing the application pool making it restart.