BUG: You receive a "Server error" error message if you try to invoke a Web service that has a name that contains a space character by using Visual C++ .NET (837379)



The information in this article applies to:

  • Microsoft ASP.NET (included with the .NET Framework 1.1)
  • Microsoft ASP.NET (included with the .NET Framework) 1.0
  • Microsoft Visual C++ .NET (2003)
  • Microsoft Visual C++ .NET (2002)
  • Microsoft Web Services (included with the .NET Framework 1.1)
  • Microsoft Web Services (included with the .NET Framework) 1.0

SYMPTOMS

You may use Microsoft Visual C++ .NET to create an XML Web service that contains a space character (" ") 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 "Url" is not capitalized correctly in this error message.

CAUSE

If you name a Web service and if that name contains a space character (" "), during run time the space character is not escaped and the space character is replaced by a plus sign ("+") instead of by "%20". The plus sign ("+") 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 (" ").
  • Replace "+" with "%20" in the Address bar when you address the Web service. To do this with the example that is described in the "More Information" section of this article, follow these steps:
    1. After you click the HelloWorld link, a Web browser window opens with an address in the Address bar.
    2. 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 "Applies to" section of this article.

MORE INFORMATION

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.
  4. In the Name box, type my webs, and then click OK.
  5. 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.
  6. On the Web page, click the HelloWorld link.

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

REFERENCES

For more information, visit the following Microsoft Developer Network (MSDN) Web site: For additional information, click the following article number to view the article in the Microsoft Knowledge Base:

816153 HOW TO: Build and use XML Web Services by using Visual C++ .NET


Modification Type:MajorLast Reviewed:3/12/2004
Keywords:kbpending kbWebServices kbWebBrowser kbweb kbProgramming kbbrowsing kbAppDev kbbug KB837379 kbAudDeveloper