在 Visual Studio 2010 中添加 Web 引用以指向 Sharepoint 2007 网站
我正在构建一个控制台应用程序,它可以加载内容类型并通过 C# 删除其上的密封。在尝试向应用程序添加 Web 引用时,我收到了一个奇怪的错误,因为我在另一个应用程序中使用了相同的 Web 引用,并且它工作正常。我很确定我之前遇到过这个问题并修复了它,但我不记得是如何解决的:(
我的步骤:
- 右键单击项目并单击添加服务引用...
- 单击高级.. . 按钮
- 单击添加 Web 引用...(当我尝试将其添加为服务引用时,我收到相同的错误)
- 将 URL 粘贴到文本框中:http://(domain)/videolibrary/_vti_bin/lists.asmx 并按Enter
- 左侧的框显示了我的所有服务操作,但为 Web 引用命名的框和添加引用按钮呈灰色,并且上面显示以下错误:
下载时出错 'http://(域)/videolibrary/_vti_bin/lists.asmx'。 无法连接到远程服务器 无法建立连接,因为 目标机主动拒绝 127.0.0.1:80 元数据包含无法解析的引用: 'http://(域)/videolibrary/_vti_bin/lists.asmx'。 没有端点在监听 http://(domain)/videolibrary/_vti_bin/lists.asmx 可以接受该消息。这是 通常是由于地址不正确引起的 或 SOAP 操作。请参阅 InnerException,如果 目前,了解更多详情。无法 连接到远程服务器 否 可以建立连接,因为 目标机主动拒绝 127.0.0.1:80 如果当前解决方案中定义了该服务,请尝试构建 解决方案并添加服务 再次参考。
编辑:尝试将目标框架从.NET Framework 4 Client Profile更改为.NET Framework 3.5,但无济于事
I'm building a console application that can load a content type and remove the seal on it through C#. In attempting to add a web reference to the application, I'm getting an error which is strange because I use the same web reference in another application and it works fine. I'm pretty sure I hit this problem before and fixed it, but I cannot remember how :(
My steps:
- Right-click project and click Add Service Reference...
- Click Advanced... button
- Click Add Web Reference... (I receive the same error when attempting to add this as a Service Reference instead)
- Paste URL in text box: http://(domain)/videolibrary/_vti_bin/lists.asmx and press Enter
- The box on the left side shows all my service operations, but the box to give the web reference a name and the Add Reference button are grayed-out and the following error is shown above:
There was an error downloading
'http://(domain)/videolibrary/_vti_bin/lists.asmx'.
Unable to connect to the remote server
No connection could be made because
the target machine actively refused it
127.0.0.1:80 Metadata contains a reference that cannot be resolved:
'http://(domain)/videolibrary/_vti_bin/lists.asmx'.
There was no endpoint listening at
http://(domain)/videolibrary/_vti_bin/lists.asmx
that could accept the message. This is
often caused by an incorrect address
or SOAP action. See InnerException, if
present, for more details. Unable to
connect to the remote server No
connection could be made because the
target machine actively refused it
127.0.0.1:80 If the service is defined in the current solution, try building
the solution and adding the service
reference again.
EDIT: Tried changing Target Framework from .NET Framework 4 Client Profile to .NET Framework 3.5 to no avail
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
以下解决了我的问题:
http:// /social.msdn.microsoft.com/Forums/zh/wcf/thread/02ce9fb9-6f67-45ec-9668-2dcd2317aab0
如果您位于防火墙后面,则需要让 Visual Studio 使用可以完成的系统代理设置通过操作 devenv.exe.config 文件。
在 Visual Studio 中打开它并更改以下部分:
The following solved my problem:
http://social.msdn.microsoft.com/Forums/zh/wcf/thread/02ce9fb9-6f67-45ec-9668-2dcd2317aab0
If you are behind firewall you need to make Visual Studio use the system proxy settings which can be done by manipulating your devenv.exe.config file.
Open it in Visual Studio and alter the section as below:
我在虚拟机上尝试过,效果很好。去算算吧。一定与我的传出代理设置有关。
I tried it from a VM and it worked fine. Go figure. Must be something with my outgoing proxy settings.
我使用的目标框架为 3.5,添加网络引用时没有遇到任何问题
我建议重试您所执行的步骤
i used target framework as 3.5 and i din't face any issue adding the webreference
i would suggest retry the steps you followed