A C# ASP.NET program under development (VS 2005) works fine in the development box, using the virtual localhost server.
Once I tried to "Publish" the site, pressing the [Build->Publish Web Site] menu option, it compiles and gives the following error:
"Data at the root level is invalid. Line 1, position 1."
The compilation fails at line 1, the line containing the [xml version="1.0" encoding="utf-8"] declaration.
The simplied web.config file is shown below. As you can see it has nothing out of the ordinary.
I have googled and found a few entries on this error, most of them talking about SOAP and web services (not what I'm doing here), and none of them have helped.
I tried to recompile taking out the encoding=utf-8 section and also taking out the xmlns definition buit I still get the same error.
Thanks James but that has been tested. It is well formed. It opens fine in IE and it works fine in VS2005 and when testing the app in localhost.
There is no blank space before the first statement. One of the things I have tried is to see if there was anything starnge in Line 1, Position 1. When adding a top blank line the compiler complained that the XML line was not the first line. There is nothing
wrong with the line per se.
I did not suspect a security/access problem but it is something to try. Unfortunately that is not the case either.
I don't understand your post. I'm not sure what path are we talking about as I'm not trying to run or open at this stage. All I'm doing is compiling/publishing to My Documents
These are the exact steps:
I have an ASP.NET project inVS2005. It has a web.config
The source files reside in a different server (our development server)
I presss F5 to run locally (debugger) and it compiles ionm the fly and opens the default page in a temporary fake IIS in localhost (my workstaion does not have IIS). Everything works fine.
Project is finished. I want now to publish and start testing in QA/Staging server.
I open menu option: [Build->Publish Web Site]. A dialog appears pointing to my target location. This is in my local PC in MyDocuments\Visual Studio 2005\Projects\<my project>\Precompiled\<project name>. The only checkbox clicked (by default) is the first
one: "Allow precompiled site to be updatable". Press OK
It compiles for a while and then comes up with this error: Data at root level is invalid...
When I double-click on the error it opens another file (tab) also called web.config with the following exact contents:
vti_encoding:SR|utf8-nl
vti_timelastmodified:TR|22 Mar 2006 13:48:12 -0000
vti_extenderversion:SR|4.0.2.7802
vti_cacheddtm:TX|22 Mar 2006 13:48:12 -0000
vti_filesize:IR|6249
I do not know what this info means or where it points to and why it mentions a 22 March date. I went to a co-developer and we created the project in his VS2005 (in his PC) and pointed to my existing app in the development server. He got the
exact same error, thereby certifying that it is not my local PC and/or my copy of VS2005 but something wrong with the source.
I checked the path to the file it was complaining about: [myProject]\_vti_cnf\web.config and saw that it was not a well-formed XML file. As it is called web.config it was confusing. I deleted the file and the problem was solved. Wonder why it was created
to begin with. It shows I'm starting with ASP.NET, doesn't it. <bg>
fsflier
Member
30 Points
6 Posts
Data at the root level is invalid. Line 1, position 1
Apr 27, 2006 03:31 PM|LINK
A C# ASP.NET program under development (VS 2005) works fine in the development box, using the virtual localhost server.
Once I tried to "Publish" the site, pressing the [Build->Publish Web Site] menu option, it compiles and gives the following error:
"Data at the root level is invalid. Line 1, position 1."
The compilation fails at line 1, the line containing the [xml version="1.0" encoding="utf-8"] declaration.
The simplied web.config file is shown below. As you can see it has nothing out of the ordinary.
I have googled and found a few entries on this error, most of them talking about SOAP and web services (not what I'm doing here), and none of them have helped.
I tried to recompile taking out the encoding=utf-8 section and also taking out the xmlns definition buit I still get the same error.
Any ideas to try next?
TIA
James Steele
Participant
875 Points
173 Posts
Re: Data at the root level is invalid. Line 1, position 1
Apr 27, 2006 05:47 PM|LINK
Hi fsflier,
A few ideas:
James Steele
fsflier
Member
30 Points
6 Posts
Re: Data at the root level is invalid. Line 1, position 1
Apr 27, 2006 06:26 PM|LINK
Thanks James but that has been tested. It is well formed. It opens fine in IE and it works fine in VS2005 and when testing the app in localhost.
There is no blank space before the first statement. One of the things I have tried is to see if there was anything starnge in Line 1, Position 1. When adding a top blank line the compiler complained that the XML line was not the first line. There is nothing wrong with the line per se.
I did not suspect a security/access problem but it is something to try. Unfortunately that is not the case either.
Thanks for the ideas. Still looking.
jbat1
Member
70 Points
14 Posts
Re: Data at the root level is invalid. Line 1, position 1
Apr 27, 2006 11:05 PM|LINK
I've seen this error when there is no file where the object is trying to open it from.
Make sure that the path you are specifiying is FOR sure where the file is.
fsflier
Member
30 Points
6 Posts
Re: Data at the root level is invalid. Line 1, position 1
Apr 28, 2006 01:29 PM|LINK
jbat1:
I don't understand your post. I'm not sure what path are we talking about as I'm not trying to run or open at this stage. All I'm doing is compiling/publishing to My Documents
These are the exact steps:
Thanks for the insight.
fsflier
Member
30 Points
6 Posts
Re: Data at the root level is invalid. Line 1, position 1
Apr 28, 2006 02:46 PM|LINK
More info:
When I double-click on the error it opens another file (tab) also called web.config with the following exact contents:
vti_encoding:SR|utf8-nl
vti_timelastmodified:TR|22 Mar 2006 13:48:12 -0000
vti_extenderversion:SR|4.0.2.7802
vti_cacheddtm:TX|22 Mar 2006 13:48:12 -0000
vti_filesize:IR|6249
I do not know what this info means or where it points to and why it mentions a 22 March date. I went to a co-developer and we created the project in his VS2005 (in his PC) and pointed to my existing app in the development server. He got the exact same error, thereby certifying that it is not my local PC and/or my copy of VS2005 but something wrong with the source.
Still stuck. :(
jbat1
Member
70 Points
14 Posts
Re: Data at the root level is invalid. Line 1, position 1
Apr 28, 2006 03:32 PM|LINK
Dangit! you caught me... sorry I just saw the error message, and honestly did not entirely read your post. I can see why you'd be confused.
I don't have anything helpful for you on this one.
fsflier
Member
30 Points
6 Posts
Re: Data at the root level is invalid. Line 1, position 1
May 01, 2006 01:49 PM|LINK
Found the problem!
I checked the path to the file it was complaining about: [myProject]\_vti_cnf\web.config and saw that it was not a well-formed XML file. As it is called web.config it was confusing. I deleted the file and the problem was solved. Wonder why it was created to begin with. It shows I'm starting with ASP.NET, doesn't it. <bg>
James Steele
Participant
875 Points
173 Posts
Re: Data at the root level is invalid. Line 1, position 1
May 01, 2006 03:37 PM|LINK
James Steele
jnc
Participant
1030 Points
380 Posts
Re: Data at the root level is invalid. Line 1, position 1
Sep 01, 2006 04:44 PM|LINK
Good one
thanks for the solution
I suspect the rogue file was left over from an upgrade from 2003