Microsoft KB Archive/837379

= BUG: You receive a &quot;Server error&quot; error message if you try to invoke a Web service that has a name that contains a space character by using Visual C++ .NET =

Article ID: 837379

Article Last Modified on 3/12/2004

-

APPLIES TO


 * Microsoft ASP.NET 1.1
 * Microsoft ASP.NET 1.0
 * Microsoft Visual C++ .NET 2003 Standard Edition
 * Microsoft Visual C++ .NET 2002 Standard Edition
 * Microsoft Web Services Enhancements for Microsoft .NET 1.1
 * Microsoft Web Services Enhancements for Microsoft .NET 2.0

-



SYMPTOMS
You may use Microsoft Visual C++ .NET to create an XML Web service that contains a space character (&quot; &quot;) in its name. When you try to call this XML Web service, you receive an error message that is similar to the following:

Server Error in '/my webs' Application.

The resource cannot be found. Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable. Please review the following URL and make sure that it is spelled correctly. Requested Url: /my webs/my+webs.asmx

Version Information: Microsoft .NET Framework Version:1.1.4322.573; ASP.NET Version:1.1.4322.573

Note The word &quot;Url&quot; is not capitalized correctly in this error message.



CAUSE
If you name a Web service and if that name contains a space character (&quot; &quot;), during run time the space character is not escaped and the space character is replaced by a plus sign (&quot;+&quot;) instead of by &quot;%20&quot;. The plus sign (&quot;+&quot;) value instead of a space character generates an address that either does not exist or may be irrelevant for that corresponding Web service or method.



WORKAROUND
To work around this problem, use any of the following methods:  Do not use space characters when you name a Web service. Use a name for the Web service that does not contain any space characters (&quot; &quot;). Replace &quot;+&quot; with &quot;%20&quot; in the Address bar when you address the Web service. To do this with the example that is described in the &quot;More Information&quot; section of this article, follow these steps:  After you click the HelloWorld link, a Web browser window opens with an address in the Address bar.  Replace the following line in the Address box

http://localhost/My%20Web2/my+webs.asmx?op=HelloWorld with the following line: http://localhost/My%20Web2/my%20webs.asmx?op=HelloWorld  



STATUS
Microsoft has confirmed that this is a bug in the Microsoft products that are listed in the &quot;Applies to&quot; section of this article.

<div class="moreinformation_section">

Steps to reproduce the behavior

 * 1) Start Microsoft Visual Studio .NET.
 * 2) On the File menu, point to New, and then click Project. The New Project dialog box appears.
 * 3) Under Project Types, click Visual C++ Projects, and under Templates, click ASP.NET Web Service.

Note In Microsoft Visual Studio .NET 2002, under Templates, click Managed C++ Web Service.
 * 1) In the Name box, type my webs, and then click OK.
 * 2) Press F5 to run the application. The mywebsClass Web Service Web page appears.

Note In Microsoft Visual Studio .NET 2002, the Class1 Web Service Web page appears.
 * 1) On the Web page, click the HelloWorld link.

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

<div class="references_section">