开发解决方案中的 Web 服务调用缓慢
好的,我使用 WSE2 获得了一个 ASP.NET Web 服务。它在 xp 机器上运行。 我在我的win7机器上安装了前端asp.net应用程序。
两者都在框架 3.5 中。
在生产环境中一切都很好。
问题是,当我运行前端的“开发”版本时,Web 服务调用会永远持续下去。我所说的永远是指永恒。在这里,我们以分钟来计算永恒。
通过“开发”版本,我的意思是我运行绑定到 Visual Studion (2008) 解决方案的实例。我使用本地 IIS Web 服务器。
我的第一个想法是我的两台机器之间的网络/防火墙问题。但是,如果我从 Visual Studio 中将该站点“发布”到另一个虚拟文件夹,那么一切都会正常工作。
所以我有 http://localhost/MyDevApp 和 http://localhost/MyPublishedApp。
两者都使用默认应用程序池。两者都有相同的 web.config。据我所知,两个虚拟目录具有完全相同的参数。
但是 http://localhost/MyDevApp 在调用 Web 服务时非常糟糕,并且 http://localhost/MyPublishedApp 以光速运行。
到现在已经3天了都是这样。
进行一些调试我可以说:
MyWebServiceRequest request = new MyWebServiceRequest ();
request.Url = "http://mywebserviceurl";
request.RequestSoapContext.Tokes.Add (MyUsernameToken);
//All these previous lines executes correctly, rapidly.
//THIS is the slow one.
request.CallWebServiceMethod ();
有人知道问题是什么吗?
编辑
我还尝试将虚拟目录从我的网站属性更改为不同的目录(例如 http://localhost/MydDevApp2),得到相同的结果。
编辑2
也许可能是因为,绑定到解决方案的站点位于c:\Projets\MySolution\MyDevApp
,而“已发布”站点位于c:\inetpub\wwwroot\ MyPublishedApp
。 c:\Projets
文件夹被排除在防病毒扫描之外,因此通常它应该更快而不是更慢。
编辑3
我在c:\inetpub\wwwroot\Other中创建了另一个工作区(解决方案在团队服务器源代码控制下),更改了Web项目的url,编译并运行:没问题。因此,看起来确实是文件所在的物理路径导致了这种情况,而绑定到解决方案的事实却并非如此。
编辑4(8月19日)
好吧,看来没什么可做的了。距离上次更新已经过去了大约10天,现在新工作区下的网站也开始变慢。所以我将工作区移动到磁盘上,现在位于 c:\inetpub\wwwroot\Other2,你知道吗?这又运行得很好了。也许10天左右我就得再次搬家了。
编辑5
我将我的问题标记为转移到服务器故障,最后它与编程无关,正如我首先想到的那样。
Ok, I got an asp.net web service using WSE2. It runs on a xp machine.
And I got the front end asp.net application in my win7 machine.
both in Framework 3.5.
In production environnement everthing is fine.
The problem is, when I run the "developpement" version of the front end, web services calls takes forever. And by forever, I mean eternity. Here we count eternity in minutes.
By "developpement" version, I mean that I run the instance that is bound to the visual studion (2008) solution. I use the local IIS web server.
My first thought was for a network/firewall problem between my two machines. But if, form visual studio, I "publish" the site to another virtual folder, then everithing works fine.
So I have http://localhost/MyDevApp and http://localhost/MyPublishedApp.
Both uses default app pool. Both have identical web.config. As far as I know, both virtual directories have exact same parameters.
But http://localhost/MyDevApp is terribly when calling web services, and http://localhost/MyPublishedApp runs at light's speed.
It is like this since 3 days now.
Doing some debuggin I can say that :
MyWebServiceRequest request = new MyWebServiceRequest ();
request.Url = "http://mywebserviceurl";
request.RequestSoapContext.Tokes.Add (MyUsernameToken);
//All these previous lines executes correctly, rapidly.
//THIS is the slow one.
request.CallWebServiceMethod ();
Does anyone have the slightest idea what the problem can be?
Edit
I also tried changing the virtual directory from my web site's property to something different (say http://localhost/MydDevApp2), with the same result.
Edit 2
Maybe it can be in cause, the site binded to the solution reside in c:\Projets\MySolution\MyDevApp
while the "published" one is under c:\inetpub\wwwroot\MyPublishedApp
. The c:\Projets
folder is excluded from the antivirus scans, so normally it should be faster rather than slower.
Edit 3
I created another workspace (the solution is under team server source control) in c:\inetpub\wwwroot\Other, changed the url of the web project, compiled and run : no problem. So it really seems that the physical path where the files resides is causing this, while the fact of beeing bound to the solution is not.
Edit 4 (August 19)
Well, it seems that there not much to do. It's been about 10 days since my last update, and now the site under the new workspace is beginning to slow down too. So I moved the workspace on disk, now in c:\inetpub\wwwroot\Other2, and you know what? That's running fine again. Perhaps I will have to move it again in about 10 days.
Edit 5
I flagged my question to move to serverfault, finally it does not have nothing to do with programmation, as I first thought.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果没有在配置中看到您的计算机,很难说,但通常这意味着您的 dns 服务器或主机文件存在某种问题,导致解析服务的过程缓慢。
另外,如果您使用代理服务器,请确保调用该服务的任何 URL 都绕过它。
Hard to say without seeing your machine in config, but often times it means you have some kind of a problem with your dns server or hosts file that is causing the process to be slow to resolve the service.
Also, if you are using a proxy server, make sure you are bypassing it for any urls that call the service.
最后,wse2 似乎跟踪了 on 的位置:
虽然日志文件增长得越来越快,但它的速度越来越慢......只需禁用跟踪即可解决问题。
Finally, it appears that wse2 traces where on :
While the log file was growing more and more, it slow down and down... just disabling the trace solves the problem.