ASP.NET Web Service Changes Port to Invoke

I have an ASP.NET web service for IIS running on port 8080. On port 80, I have Apache that redirects some websites to IIS.

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

Internally, the web service runs on port 8080, but a public request must be completed on port 80.

Does anyone know how I can solve my problem?

PS: Using IIS 7 and Apache 2.2 under Windows Server 2008

+5
source share
1 answer

The most likely reason for this is because the WSDL web service created will determine the address of the service endpoint as:

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

You can provide a separate static definition for WSDL 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>

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

Another alternative method to make the correct address appear in the generated WDSL is to use it SoapExtensionReflectorto change the address locationon the fly:

WSDL - SoapExtensionReflector

.

, .NET, URL- :

WebClientProtocol.Url( MSDN)

+3

All Articles