添加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. OC随笔一:类

    总结:        在oc中,我们要整出一个类来,首先需要一个.h头文件和一个.m实现文件.一般我们创建的类都继承了根类,因为根类帮我们实现了很多实用的方法,而类里面会有变量(属性) .函数(方法) ...

  2. servlet 具体实现

    1)servlet 具体实现 1.在GenericServlet中声明了一个ServletConfig类型的成员变量,在init(ServletConfig)方法中对其进行了初始化 2.利用servl ...

  3. DOM 添加 / 更新 / 删除 XML (CURD)

    获得Document /**     * 获取文档     * 1.获得实例工厂     * 2.获得解析器     * 3.获得document     */ 添加结点 /**     * 1.获得 ...

  4. poj3071

    题目大意,1<<n个球队比赛赛程是这样的 1 1    1 1   1 1  1 另dp[i][k]为k队进入第i场的概率 #include<iostream> #includ ...

  5. 逆向并查集 hrbust 1913

    #include<iostream> //由于拆除并查集的方法太难或者没有#include<cstdio> //可以先将所有没有拆的桥连接 再逆向操作 断开变成连接 反向输出# ...

  6. HDU4545+计算日期

    /* 计算过了D天后的日期 之前D天的日期 */ #include<stdio.h> int judge_year( int year ){ if( (year%4==0&& ...

  7. MVC-生成验证码

    1.在网上可以随便找一个生成验证码的类例如: using System; using System.Drawing; using System.Drawing.Imaging; using Syste ...

  8. 仿校内textarea输入框字数限制效果

    这是一个仿校内textarea回复消息输入框限制字数的效果,具体表现如下: 普通状态是一个输入框,当光标获取焦点时,出现字数记录和回复按钮 PS:上边那个小三角可不是用的图片. 普通状态效果如下: 获 ...

  9. 怎样使用pyinstaller打包

    安装好pyinstaller后 cd 到pyinstaller.py目录,在命令行输入:python pyinstaller.py 参数 主文件所在目录 如:python pyinstaller.py ...

  10. JS 操作一个数据值

    任何语言都有自己的操作数据的方法: Js也不例外,js有3种重要的方式来操作一个数据值. 1>复制它.例如把它赋给一个新的变量. 2>把它作为参数传递给一个函数或方法. 3>可以和其 ...