Microsoft KB Archive/815213

= BUG: Error Occurs When You Try to Add a Web Reference to a Web Service That a Proxy Server Publishes =

Article ID: 815213

Article Last Modified on 11/14/2003

-

APPLIES TO


 * Microsoft ASP.NET 1.1
 * Microsoft ASP.NET 1.0

-





SYMPTOMS
In an ASP.NET Web Application project, when you try to add a Web reference to a Web service that a proxy server publishes, you may receive an error message that is similar to the following error message.

Microsoft .NET Framework 1.0

Unable to download the following files from http:// /WebService2/service1.asmx?op=HelloWorld, http:// :6789/WebService2/service1.asmx?wsdl. Do you want to skip these files and continue?

Microsoft .NET Framework 1.1

Unable to download the following file from http:// :6789/WebService2/service1.asmx?wsdl. Do you want to skip this file and continue?

Note Throughout this article,  is a placeholder for the IP address of the proxy server.



CAUSE
From a Web client, you try to add a Web reference to a Web service so that the internal Web server is inside a proxy network. The Redirect port number of the proxy server is then attached to the Internet Protocol (IP) address of the proxy server in the generated proxy class instead of the Listener port number of the proxy server being attached to the IP address of the proxy server in the generated proxy class.



WORKAROUND
To work around this bug, use the Web Services Description Language tool (Wsdl.exe) to create a client proxy class and then modify the proxy class to update the URL information with the correct port number.

To do this, follow these steps:  Create a client proxy class.

To do this, follow these steps:  In Microsoft Windows Explorer, create a folder that is named Clientproxy in the C:\ root directory. At a Microsoft Visual Studio .NET command prompt, change the directory path to the C:\Clientproxy directory. At the Visual Studio .NET command prompt, run the following command.

Microsoft Visual C# .NET

wsdl http:// /WebServiceProxy/Service1.asmx?wsdl

The client proxy class is saved as the Service1.cs file.

Microsoft Visual Basic .NET

wsdl /l:VB http:// /WebServiceProxy/Service1.asmx?wsdl

The client proxy class is saved as the Service1.vb file.  Modify the client proxy class.

To do this, follow these steps:   Use Notepad to open the Service1.cs file or to open the Service1.vb file.

The proxy URL contains the port number (6789) of the internal Web server as follows: http:// :6789/WebServiceProxy/service1.asmx </li>  In Visual C# .NET, modify the Service1 method of the proxy class, and then save the Service1 method of the proxy class, as follows: public Service1 {  this.Url = &quot;http:// /WebServiceProxy/service1.asmx&quot;; } In Visual Basic .NET, modify the New method of the proxy class, and then save the New method of the proxy class, as follows: Public Sub New MyBase.New Me.Url = &quot;http:// /WebServiceProxy/service1.asmx&quot; End Sub </li></ol> </li> Compile the proxy class code that is stored in the Service1.cs file or in the Service1.vb file to create the Service1.dll assembly.

To do this, follow these steps:  At a Visual Studio .NET command prompt, change the directory path to the C:\Clientproxy directory.</li> At the Visual Studio .NET command prompt, run the following command:

Visual C# .NET

csc /t:library Service1.cs

Visual Basic .NET

vbc /t:library /r:System.XML.dll,System.Web.Services.dll,System.Data.dll,System.Web.dll,System.dll Service1.vb

The Service1.dll file is created.</li></ol> </li> Create an ASP.NET Web Application project.

To do this, follow these steps:  Start Visual Studio .NET.</li> Use Visual C# .NET or use Visual Basic .NET to create an ASP.NET Web Application project that is named Project1 .</li> In Solution Explorer, right-click Project1, and then click Add Reference.</li> In the Add Reference dialog box, click Browse.</li> In the Select Component dialog box, locate the C:\Clientproxy folder.</li> Click Service1.dll, and then click Open.</li> Click OK to close the Add Reference dialog box.</li></ol> </li></ol>

<div class="status_section">

STATUS
This behavior is by design.

<div class="moreinformation_section">

Publishing Rules of the ISA Server When It Is Installed on a Proxy Server
Set the publishing rule for the ISA server to redirect all the incoming requests to the internal Web server. The Listener listens on port 80 and then redirects all the incoming requests to port 6789.

Note You can configure your proxy server to redirect incoming requests to any port other than port 6789.

Web Site Configuration on the Internal Web Server
Configure the default Web site to run on port 6789 on the internal Web server.

Create an ASP.NET Web Service Project on a Computer (Internal Web Server) That Is Inside a Proxy Network
<ol> <li>Start Visual Studio .NET.</li> <li>Use Visual C# .NET or use Visual Basic .NET to create an ASP.NET Web Service project that is named WebServiceProxy.

By default, the Service1.asmx file is created.</li> <li>In Solution Explorer, right-click Service1.asmx, and then click View Code.</li> <li>Uncomment the HelloWorld Web service method.</li> <li>On the Build menu, click Build Solution.</li> <li>Configure the default Web site to run on port 6789.

To do this, follow these steps: <ol style="list-style-type: lower-alpha;"> <li>Click Start, and then click Run.

The Run dialog box is displayed.</li> <li>Type Inetmgr in the Open box, and then click OK.</li> <li>In the Internet Information Services Manager window, click your  .</li> <li>Click the Web Sites folder.</li> <li>Under the Web Sites folder, right-click the Default Web Site folder. Click Properties.</li> <li>On the Default Web Site Properties dialog box, click the Web Site tab.</li> <li>In the TCP port text box, type 6789 .</li> <li>Click OK to close the Default Web Site Properties dialog box.</li></ol> </li> <li>To verify that the WebServiceProxy Web service is working correctly, use your Web browser to visit the following URL:

http:// :6789/WebServiceProxy/Service1.asmx

Note In this URL,  is a placeholder for the name of your internal Web server.</li></ol>

Create an ASP.NET Web Application Project on a Computer That Is Outside the Proxy Server

 * 1) Start Visual Studio .NET.
 * 2) Use Visual C# .NET or use Visual Basic .NET to create an ASP.NET Web Application project that is named Project1.
 * 3) On the Build menu, click Build Solution.

Add a Web Reference to the Web Service

 * 1) In Solution Explorer, right-click References, and then click Add Web Reference.

The Add Web Reference dialog box is displayed.
 * 1) Type http:// /WebServiceProxy/Service1.asmx in the Address box, and then click Go.
 * 2) When the proxy server prompts you for authentication credentials, type your  and type your  in the corresponding text boxes.

You receive the error message that is mentioned in the &quot;Symptoms&quot; section of this article.

Note If the IP address in the error message contains the port number of the internal Web server, configure the publishing properties of the ISA server to display the IP address of the proxy server instead of displaying the IP address of the internal Web server.

<div class="references_section">