ASP.NET Web服务调用上端口变化 [英] ASP.NET Web Service changes port on Invoke

查看:262
本文介绍了ASP.NET Web服务调用上端口变化的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个ASP.NET Web服务在IIS,即工作在8080端口上的端口80我的Apache,就是重定向一些网站到IIS。

I have a ASP.NET Web Service on IIS, that is working on port 8080. On port 80 I have Apache, that is redirecting some web sites to IIS.

在这种情况下,我可以访问Web服务页面( http://example.com/service/),这给了我所有的可用方法。然而,当我尝试调用的方法,它关系到一个网页像这样的: HTTP ://示例.com:8080 /服务/ Service1.asmx的/法。当然,一个公共接入看不到任何结果,8080端口被阻塞,无法打开。

On this case, I can access the Web Service page (http://example.com/service/), which gives me all the methods available. However, when I try to invoke a method, it goes to a web page like this one: http://example.com:8080/service/Service1.asmx/Method. Of course that a public access can not see any result, the port 8080 is blocked and can not be opened.

在内部,Web服务的工作在8080端口上,但市民的要求需要做的端口80。

Internally, the Web Service works on port 8080, but the public request need to be done to the port 80.

任何人都知道我怎么能解决我的问题?

Anyone knows how can I solve my problem?

P.S:使用IIS 7和Apache 2.2在Windows Server 2008

P.S.: Using IIS 7 and Apache 2.2 under Windows Server 2008

推荐答案

这最可能的原因是,您的Web服务生成的WSDL将定义服务端点地址:

The most likely reason for this is that your web service generated WSDL will define the service endpoint address as:

http://example.com:8080/service/service1.asmx

您可以提供一个单独的静态WSDL定义和修改下面的部分使用80端口:

You could provide a separate static WSDL definition and modify the following section to use port 80:

<wsdl:service name="Service1"> 
    <wsdl:port name="Service1Soap" binding="tns:Service1Soap"> 
        <soap:address location="http://example.com:8080/service/service1.asmxx" /> 
    </wsdl:port> 
    <wsdl:port name="Service1Soap12" binding="tns:Service1Soap12"> 
        <soap12:address location="http://example.com:8080/service/service1.asmx" /> 
    </wsdl:port> 
</wsdl:service>

这应该导致客户端消耗WSDL和生成存根code绑定到正确的端口(这是Apache服务器充当代理)。

This should cause the client to consume the WSDL and generate stub code to bind to the correct port (which is the Apache server acting as a proxy).

另一种替代方法强制正确的地址出现在生成的WDSL是使用<一href=\"http://msdn.microsoft.com/en-us/library/system.web.services.description.soapextensionreflector.aspx\"相对=nofollow> SoapExtensionReflector 修改地址位置飞:

Another alternative method to force the correct address to appear in the generated WDSL is to use a SoapExtensionReflector to modify the address location on the fly:

修改Web服务的WSDL使用SoapExtensionReflector

我用上面的方法成功地过去。

I have used the above method successfully in the past.

另外,你可以,如果客户端是基于.NET,覆盖服务基地网址:

Alternatively, you could, if the client is .NET based, override the base URL for the service:

<一个href=\"http://msdn.microsoft.com/en-us/library/system.web.services.protocols.webclientprotocol.url.aspx\"相对=nofollow> WebClientProtocol.Url属性(MSDN库)

这篇关于ASP.NET Web服务调用上端口变化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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