FIX: Error occurs when you access the Global.asax file for a Visual C# .NET Web Serviceproject in Visual Studio .NET (821317)
The information in this article applies to:
- Microsoft Visual C++ .NET (2002)
- Microsoft Visual C# .NET (2002)
- Microsoft ASP.NET (included with the .NET Framework) 1.0
SYMPTOMSWhen you access the contents of the Global.asax file in
Microsoft Visual Studio .NET for a Visual C# .NET Web Service project, you may
receive the following error message: This XML
document is not well formed. It contains the following error: There is invalid
data at the root level Line 1, position 1. Additionally, the
contents of the Web.config file may be overwritten. CAUSEThe problem occurs when a solution that contains a Visual C#
.NET Web Service project has a Visual C++ .NET Web Service project added to the
same solution. In Visual Studio .NET, the name of the solution is the name of
the first project that was created in the solution. If a Visual C# .NET Web
Service project is the first project that is created in the solution, the name
of the solution is the same name as that Visual C# .NET Web Service project.
When you add a Visual C++ .NET Web Service project to the solution, a directory
is created in Internet Information Services (IIS) that has the same name as the
name of the solution. Because the Visual C# .NET Web Service project has
already created a directory in IIS with a project name that is the same as the
solution name, both the Visual C# .NET Web Service project and the Visual C++
.NET Web Service project share this directory. When different Web Service
projects share the same directory, this may cause the Web.config and the
Global.asax files of one Web Service project to overwrite the Web.config and
the Global.asax files of another Web Service project.
This problem
only occurs when you add an additional Visual C++ .NET Web Service project.
This does not occur with additional Visual C# .NET Web Service projects or with
Microsoft Visual Basic .NET Web Service projects because they are created in
separate directories that correspond to their project names. Projects are
created in a directory that corresponds to the solution name instead of to the
project name only when you add additional Visual C++ .NET Web Service
projects.WORKAROUNDTo work around this problem, use one of the following
methods:
- If your solution has only one Visual C++ .NET Web Service
project, create the Visual C++ .NET Web Service project as the first project in
the solution.
- If your multi-project solution has a project that is not
Web Service-based, create that project first in the solution. When the Visual
C++ .NET Web Service project is created, the directory that is created in IIS
will not be an existing directory that was created for another Web Service
project.
Note Do not create more than one Visual C++ .NET Web Service project
in a solution because the Web.config and Global.asax files of the previous
Visual C++ .NET Web Service projects are overwritten by the later Visual C++
.NET Web Service projects.
STATUS
Microsoft has confirmed that this is a bug in the Microsoft products that are
listed at the beginning of this article.
This bug was corrected in Microsoft Visual C# .NET (2003).
Modification Type: | Minor | Last Reviewed: | 1/13/2006 |
---|
Keywords: | kbfix kbide kbweb KB821317 kbAudDeveloper |
---|
|