“更新 Web 参考”出现问题

发布于 2024-07-25 19:45:27 字数 847 浏览 2 评论 0 原文

有时,当我尝试在 Visual Studio 2008 中更新 Web 引用时会遇到问题(这也发生在 VS2005 中)。 这种情况已经在几种不同的解决方案中发生过。 当我有一个包含 (.NET 2.0) Web 服务的解决方案和一个引用该 Web 服务的项目时,我收到“下载 'http://localhost:3890/MyWebService.asmx'无法连接到远程服务器。”。 显然,示例中的端口号只是一个示例,它可以是任何端口号。

Web 引用设置为“动态 URL”,并且 Web 服务使用 ASP.NET Development Server Web 服务器而不是 IIS。 发生错误时,该服务的图标永远不会显示在系统托盘中。

我找到了两种解决方法。 更彻底的解决方法是删除 Web 引用并重新创建它。 这每次都对我有用,但给 Subversion 和 AnkhSVN 带来了一些混乱。

最近我想到将Web服务设置为启动项目,启动它,然后将鼠标悬停在系统托盘上的ASP.NET Development Server图标上以找出它选择的端口号。 然后,编辑 Web 引用的 WebReferenceUrl 属性中的端口号。 完成此操作后,我可以更新网络参考。

虽然这有效,但我觉得必须有更好的方法。 看来 VS 和卡西尼号应该能够在无需人工干预的情况下解决这个问题。 我是否遗漏了什么,或者这是微软把困难的事情做对而简单的基础做错的另一个例子?

我试图寻找这个问题的答案,并发现了几个描述该问题的线程。 但是,没有人找到真正的解决方案。

Occasionally I have a problem when I attempt to update a web reference in Visual Studio 2008 (this also happened in VS2005). It has happened in several different solutions.
When I have a solution with a (.NET 2.0) web service and a project that references the web service I get "There was an error downloading 'http://localhost:3890/MyWebService.asmx' Unable to connect to the remote server.". Obviously, the port number in the example is an example only, it could be any port number.

The web reference is set to 'Dynamic URL' and the web service is using the ASP.NET Development Server web server rather than IIS. When the error occurs the icon for the service never shows up in the system tray.

I have found two workarounds. The more drastic workaround is to delete the web reference and recreate it. This has worked for me everytime, but has caused some confusion for Subversion and AnkhSVN.

Recently it occurred to me to set the web service as the startup project, start it, and mouse over the ASP.NET Development Server icon on the system tray to find out the port number that it has chosen. Then, edit the port number in the WebReferenceUrl property of the web reference. After doing this I can update the web reference.

While this works I feel that there must be a better way. It seems that VS and Cassini should be able to resolve this without manual intervention. Am I missing something, or is this another case of Microsoft getting the difficult things right and the simple basics wrong?

I have attempted to search an answer for this issue and have found several threads describing the problem. But, no one has identified a real solution.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

心头的小情儿 2024-08-01 19:45:27

在解决方案资源管理器中右键单击该服务,然后选择“在浏览器中查看”。 这将导致服务启动,并且您将能够使用“添加 Web 引用”。

Right-click the service in Solution Explorer, and choose "View in Browser". That will cause the service to start, and you'll be able to use "Add Web Reference".

痴情 2024-08-01 19:45:27

您可以在 Visual Studio 中强制测试网站的端口。

使用“F4”或通过工具栏-“视图”-> 打开 Visual Studio 中的属性窗口 “属性窗口”。
在“解决方案资源管理器”窗口中左键单击您的网站。 请注意“使用动态端口”设置的下拉列表。 如果将此设置为“False”,您将能够在“端口号”字段中指定固定端口。
将其设置为您所需的端口值。
启动您的网站。 您将看到使用的端口与您指定的值匹配。

You can force the port of the test web site in visual studio.

Open the properties window in visual studio it with "F4" or via the toolbar - "View" -> "Properties Window".
Left click on your web site in the "Solution Explorer" window. Notice the drop down list for the "Use dynamic ports" setting. If you set this to "False", you'll then be able to specify a fixed port in the "Port number" field.
Set this to your desired port value.
Launch your web site. You'll see the port used matches the value you specified.

海的爱人是光 2024-08-01 19:45:27

转到项目属性-> 设置-> [更新服务​​网址]
有用。

Go to project Properties-> Settings -> [Update the Service Url]
It Works.

别理我 2024-08-01 19:45:27

检查 appconfig 文件并相应更新端口号

Check appconfig file and update the port number accordingly

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文