Data at the root level is invalid. Line 1, position 1.
-
Hi all, I have a web service that used to work but stopped working when I migrated to a new computer. The new computer comes with Windows 8.1 and IIS Express. I made sure that I got everything I need by selecting every option under IIS. I installed the same version of Visual studio (VS 2012) on the new machine and tried to run the same web app I had in the old machine. When I click a button which makes a call to my web service, nothing happens. I found out through Fidler2 that the problem was
"Data at the root level is invalid. Line 1, position 1."
I have searched online but none matched my situation. Basically all I'm trying to do is send text from a regular html page in the form of JSON to the web service. Then the web service will modify a text file on the server using the text it received. I know the code in the web service works because I called it directly in Visual Studio and it worked fine. Please suggest a way to fix this problem, thanks in advance
-
Hi all, I have a web service that used to work but stopped working when I migrated to a new computer. The new computer comes with Windows 8.1 and IIS Express. I made sure that I got everything I need by selecting every option under IIS. I installed the same version of Visual studio (VS 2012) on the new machine and tried to run the same web app I had in the old machine. When I click a button which makes a call to my web service, nothing happens. I found out through Fidler2 that the problem was
"Data at the root level is invalid. Line 1, position 1."
I have searched online but none matched my situation. Basically all I'm trying to do is send text from a regular html page in the form of JSON to the web service. Then the web service will modify a text file on the server using the text it received. I know the code in the web service works because I called it directly in Visual Studio and it worked fine. Please suggest a way to fix this problem, thanks in advance
Sounds like mal-formed XML. Have a look and give an example.
-
Sounds like mal-formed XML. Have a look and give an example.
-
Hi, thanks for responding. I am not reading or writing any XML. In fact even after removing all the code in the webmethod of my webservice except for the return statement
return "Success!";
I still get the same error.
Yes you are, you just don't know it. Have a look in your web.config file and you'll probably file the XML in there is messed up.
A guide to posting questions on CodeProject
Click this: Asking questions is a skill. Seriously, do it.
Dave Kreskowiak -
Hi, thanks for responding. I am not reading or writing any XML. In fact even after removing all the code in the webmethod of my webservice except for the return statement
return "Success!";
I still get the same error.
JSON is XML, is it not?
-
Yes you are, you just don't know it. Have a look in your web.config file and you'll probably file the XML in there is messed up.
A guide to posting questions on CodeProject
Click this: Asking questions is a skill. Seriously, do it.
Dave KreskowiakHi, thanks for replying. I validated the webconfig file and it is actually valid. It turns out the problem was in the url in my ajax. I copied and paste the webservice url from Visual Studio and it appears a couple of letters were automatically tacked onto the url between the webservice name and the webmethod name. Once I removed the extra letters everything worked fine.
-
JSON is XML, is it not?
Hi, thanks for replying. You got me thinking for a minute there with your question
"JSON is XML, is it not?"
According to json.org JSON is not XML, it's an alternative to XML. Also the website
http://searchwindevelopment.techtarget.com/definition/JSON-Javascript-Object-Notation
says the following:
"JSON was originally based on the Javascript programming language and was introduced as the page scripting language for the Netscape Navigator Web browser"