I am trying to create my first ASP.Net Web Service using Visual Studio 2010 and I keep coming up against a roadblock.
When I try to build, I get the following error:
Error Character is not valid. Line 1, Column 2.
When I click, it goes through to the page, and there is just the default, auto-generated line:
<%@ WebService Language="VB" CodeBehind="Service1.asmx.vb" Class="testweb1.Service1" %>
I have tried to look up this error, and I found a solution is to simply close and reopen the project - This works about 1 in 5 times, but then after making a tiny change, it can come back. Another solution is to change the extension from .asmx
to .anything
and then back again - however, this causes Visual Studio to crash.
Edit - (Simplified question above and add)
I just solved this, - As the web service needs to be compiled in order to run, I thought that a good solution was to change the .asmx
file's build action to Compile
. Switching this to Content
has made the error go away.
However, I am not convinced - now I have to manually build the project and the one time Visual Studio did not crash, renaming and going back worked fine.
Am I going crazy or did I do something wrong? Can someone point me in the correct direction!?