0

I have a website where I am using the JSON webservice. I have uploaded my website on the server.

Problem:

When I try to access the webservice it gives me the error as shown in below screenshot. In the below screenshot MyServices is my webservice. MyServices.asmx is the name of the file that I am trying to access.

Troubleshooting that already has been done:

I tried cleaning the bin folder and rebuilding again. But it didn't work.

What could be wrong?

alt text

1 Answer 1

1

This error might occur if you are using a Web Application type project (in contrast to Web Site) and you have put code in the App_Code special folder. This folder should be used only with WebSite project types. A Web Application is compiled meaning that all source code is precompiled into an assembly and placed into the bin folder. On the other hand App_Code is a special folder. ASP.NET automatically compiles dynamically everything in this folder when the first request arrives so you find yourself with two assemblies that contain the same class.


Visual Studio uses different icons to represent web site and web application which might help you find out which type you are using:

alt text

Sign up to request clarification or add additional context in comments.

3 Comments

Thanks for the input. How can I find whether it is Web Application or Website? I have added my Webservice Code file i.e. MyServices.cs file into my App_Code folder.
Ok Thanks Darin Dimitrov. So mine is Web Application. Now should I keep my MyServices.cs file outside the App_Code folder?
Yes, you should keep it out for web applications. Don't use the App_Code folder in precompiled web applications. Just put the source code in some other folder outside and this will solve your problem.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.