添加web引用会在相应项目的app.cofig文件中产生如下代码:

<sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
            <section name="BS.EAP.BizMgt.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
        </sectionGroup>

………………

<BS.EAP.BizMgt.Properties.Settings>
            <setting name="BS_EAP_BizMgt_IPersonCard_PetroChina" serializeAs="String">
                <value>http://10.27.213.172:8080/PetroChinaService/PetroChina</value>
            </setting>
            <setting name="BS_EAP_BizMgt_GetVisitService_ReportSSO" serializeAs="String">
                <value>http://10.88.248.111:88/dm/cxf-services/ReportSSO</value>
            </setting>
        </BS.EAP.BizMgt.Properties.Settings>
    </applicationSettings>
</configuration>

红色字部分是所引用web服务地址:http://10.88.248.111/dm/cxf-services/ReportSSO

要手动增加上端口88问题解决

以下内容应用自:http://www.cnblogs.com/BruceLee521/archive/2012/03/28/2420776.html

Webservice 通过映射端口发布到外网,调用报错解决

环境:

Webservice部署到内网机器,地址:http://aaa.bbb.ccc.ddd/xkzjk/LicensesService.asmx

通过端口影射到外网地址:http://eee.fff.ggg.hhh:88/xkzjk/LicensesService.asmx

同事碰到的第一个问题:

在Visual Studio中引用Webservice报如下错误:

在Visual Studio 2008下报如下错误:

Unable to download following files from.

http://eee.fff.ggg.hhh:88/xkzjk/LicensesService.asmx?wsdl

Do you want to skip these files and continue?

在Visual Studio 2010报如下错误:

An error(Details) occurred while attempting to find services at ‘http://eee.fff.ggg.hhh:88/xkzjk/LicensesService.asmx

元数据包含无法解析的引用:“http://eee.fff.ggg.hhh:88/xkzjk/LicensesService.asmx?wsdl”。
下载“http://eee.fff.ggg.hhh:88/xkzjk/LicensesService.asmx?wsdl”时出错。
请求因 HTTP 状态 503 失败: Service Temporarily Unavailable。
元数据包含无法解析的引用:“http://eee.fff.ggg.hhh:88/xkzjk/LicensesService.asmx?wsdl”。
元数据包含无法解析的引用:“http://eee.fff.ggg.hhh:88/xkzjk/LicensesService.asmx?wsdl”。
If the service is defined in the current solution, try building the solution and adding the service reference again.

原因:

开发人员对Webservice不懂,WSDL不知道是干什么的,引用的地址少了?wsdl,第一个问题解决。

同事碰到的第二个问题:

调用具体webservice方法时时报如下错误

请求因 HTTP 状态 503 失败: Service Temporarily Unavailable。

说明: 执行当前 Web 请求期间,出现未经处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。 
异常详细信息: System.Net.WebException: 请求因 HTTP 状态 503 失败: Service Temporarily Unavailable。

分析:

具体去看异常内部信息:

ResponseUri={http://eee.fff.ggg.hhh/xkzjk/LicensesService.asmx},开始没仔细看,后来找了很久,发现少了外网映射的端口88。

原因:

在Visual Studio 2008中引用Webservice时,在Web.config中自动增加如下节

<applicationSettings>
    <Test.Web.Properties.Settings>
      <setting name="Test_Web_LicService_LicensesService" serializeAs="String">
        <value>http://eee.fff.ggg.hhh/xkzjk/LicensesService.asmx</value>
      </setting>
    </Test.Web.Properties.Settings>
  </applicationSettings>

在工程的Settings.settings文件中增加了App的设置,代理类会使用该设置的变量。

在Visual Studio 2010中引用Webservice时,在Web.config中自动增加如下节

endpoint address="http://eee.fff.ggg.hhh/xkzjk/LicensesService.asmx"
        binding="basicHttpBinding" bindingConfiguration="LicensesServiceSoap"
        contract="ServiceReference1.LicensesServiceSoap" name="LicensesServiceSoap" />

定义了Webservice的一些基本信息。

请注意Visual Studio都把端口去掉了。手动在Web.config里增加上88端口问题解决。

总结:第一个问题是因为对Webservice的原理不明白。第二个对Visual Studio引用Webservice的原理不清楚,只会用,现在很多人对Webservice的一些基本理论知识都不明白,就是上来就用Visual Studio引用,然后调用。

调用具体webservice方法时时报错误:请求因 HTTP 状态 503 失败: Service Temporarily Unavailable的更多相关文章

  1. 调用webserver时出现:请求因 HTTP 状态 401 失败: Unauthorized。

    请求因 HTTP 状态 401 失败: Unauthorized 今天在调用webserver时出现了上述标题的错误,开始认为是由于端口的问题,我把端口恢复80默认端口后,但是问题并没有解决!后来我自 ...

  2. android ksoap2调用.net Webservice 方法总结

    android  ksoap2调用.net Webservice 方法直接放到一个类里: package com.util; import org.ksoap2.SoapEnvelope; impor ...

  3. 在执行context.getContentResolver.query()方法时出现错误。

    1. 在执行context.getContentResolver.query()方法时出现错误. 07-15 18:46:13.470: E/AndroidRuntime(13624): FATAL ...

  4. 无法解析此远程名称: 'www.***.com' 解决办法 请求因 HTTP 状态 417 失败

    今天在做接口开发时,遇到了一个异常:无法解析此远程名称: 'www.***.com'.我的网站一直是运行正常的,从昨天开始出现异常,用户可以使用,但我的服务器怎么也无法实现对数据库的更新. 分析原因: ...

  5. Web service request SetParameters to Report Server http://host/reportserver failed. Error: 请求因 HTTP 状态 401 失败: Unauthorized

    迁移CRM服务器完成后在访问CRM的内部报表时报错,在查看应用服务器的日志时发现报"Web service request SetParameters to Report Server ht ...

  6. Magento Service Temporarily Unavailable解决方法

    插件升级错误或安装失败时 会出现Service Temporarily Unavailable错误,使网站前台后台都无法显示. 在操作完成的情况下,仍然出现这个错误时可以采用以下方法: 1.删除网站站 ...

  7. OSGI.NET,请求因HTTP状态404 失败:Not Found

    在VS里使用OSGI.NET可以正常运行项目和插件,开放工厂远程管理工具也可以使用,没有任何异常.可是,当我把项目部署到IIS上,网站可以正常运行,插件也正常:使用开放工厂远程管理工具时,就出现&qu ...

  8. magento错误 Service Temporarily Unavailable magento

    前台访问出现错误 Service Temporarily Unavailable magento 解决方法 Service TemporarilyUnavailable字面意思是此服务暂时无法使用,如 ...

  9. Java调用.NET webservice方法的几种方式

    最近做项目,涉及到web-service调用,现学了一个星期,现简单的做一个小结.下面实现的是对传喜物流系统(http://vip.cxcod.com/PodApi/GetPodStr.asmx?ws ...

随机推荐

  1. Hadoop shuffle与排序

    Mapreduce为了确保每个reducer的输入都按键排序.系统执行排序的过程-----将map的输出作为输入传给reducer 称为shuffle.学习shuffle是如何工作的有助于我们理解ma ...

  2. [C#] 后端post的请求方法

    C# 模拟post请求方法 方法1: /// <summary> /// 模拟Post请求 /// </summary> /// <param name="ur ...

  3. Ubuntu中安装编译并测试HTK语音识别库

    1.在网上看到首先必须确保电脑上安装了g++和libx11 g++ --version //检测g++版本 sudo apt-get install libx11-dev:i386 2.然后可从HTK ...

  4. mongodb一个关键字对多个字段同时查询,mongodb $or $and查询

    $query = '{ "$and": [                 {"$or": [{"reported": {"$ex ...

  5. lib,dll区别 及 VS中如何添加lib,dll

    1.加载lib/头文件 分两种方法: (1)适用于当前项目 第一步:项目->属性->C/C++->常规->附加包含目录(浏览.h文件的路径) 添加包含文件 第二步:项目-> ...

  6. Mysql中natural join和inner join的区别

    假设有如下两个表TableA,TableB TableA TableB Column1 Column2 Column1 Column3 1 2 1 3 TableA的Column1列名和TableB的 ...

  7. DeDe调用指定栏目ID下的文章

    *注: row: 调用条数 titlelen: 字数 typeid: 调用的栏目ID orderby: 按照升序对记录进行排序 idlist: 提取特定文档为空 infolen='40' 内容简介长度 ...

  8. python之6-2高阶函数

    1. map函数 map(函数A,字符串或者列表) map函数的意思是将函数A依次作用到字符串的每个字符或者列表的每个元素. 例如: map(lambda x: x*x,[1,2]) [1, 4] 这 ...

  9. 判断Python输入是否为数字

    在接收raw_input方法后,判断接收到的字符串是否为数字 例如: str = raw_input("please input the number:") if str.isdi ...

  10. HADOOP都升级到2.5啦~~~

    经过前年的初次接触,现在已大约能理解整个体系啦.MAPREDUCE都改成YARN啦. 不过,还得继续往前走,再能实用... HIVE,HBASE,ZOOKEEPER,, 思路如下: 安装系统,配置网络 ...