如何在c#Web应用程序中向外部托管的Web服务添加Web引用? [英] How can I add a web reference to an externally hosted web service in my c# web application?

查看:242
本文介绍了如何在c#Web应用程序中向外部托管的Web服务添加Web引用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嘿程序员!!!



在向外部托管的asmx webservice添加Web引用时,我收到错误Value不能为null。

参数名称:discoveryError&mexError。并且添加参考按钮显示为禁用。请帮助我。

Hey programmers!!!

While adding a web reference to an externally hosted asmx webservice I am getting an error "Value cannot be null.
Parameter name: discoveryError & mexError". And the button "Add reference" appearing disabled. Kindly help me people.

推荐答案

I've found the solution.  And let me share the solution so that it can benefit others.
We have to change the web.config file of the project. Just add these tags in web.config file.

<system.net>
  <defaultProxy useDefaultCredentials="true">
  <proxy proxyaddress="http://direct.data.com/cmv/cmv.asmx"  bypassonlocal="True"/>
  </defaultProxy>
  </system.net>

And Then create the object of the service reference like this(in .aspx.cs file).

reference_Name.Service_NameSoapClient object_name =
 new reference_Name.Service_NameSoapClient();

And then call the web method like this.

object_name.method_name(parameter1,parameter2);

Here I've made the explanation generic by using reference_Name,Service_Name, object_name
These are not keywords :)


转到互联网属性 - >局域网设置 - >高级 - >在添加引用的pc中添加IP(不要使用代理地址)。问题已解决。
Goto internet properties --> LAN settings --> Advanced --> Add the IP to (do not use proxy for address) in pc where reference is added . Issue resolved.


这篇关于如何在c#Web应用程序中向外部托管的Web服务添加Web引用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆