Web Service error 'Could not create type' when calling service from Ajax Web Service error 'Could not create type' when calling service from Ajax ajax ajax

Web Service error 'Could not create type' when calling service from Ajax


I fixed this in the end.

In VS 2005 I just needed to right click on the web service and select "View Markup". I just changed the markup to use the correct namespace:

Line 1:  <%@ WebService Language="C#" CodeBehind="List.asmx.cs" Class="List" %>

I Just removed the project name from the namespace to match the namespace used by List.asmx and this error went away.


In my instance I had renamed the class something different than the .asmx file, so when referencing the file from the .aspx code it would generate this error.

So I had 'AjaxManager.asmx', but had renamed the class to 'AjaxService', and the markup did not match. In my case, leaving the fully qualified namespace did not cause any issue. So if you change the class name (probably not reccomended anyway), make sure to correct the markup as well as shown below:

<%@ WebService Language="vb" CodeBehind="AJAXManager.asmx.vb" Class="MyProject.UI.AjaxService" %>


One more Important Things and simple solution that i found out while creating web service . Try to avoid creating code behind file

I was facing same problem while accessing web service in a virtual directory in iis 7 , then i created inline code asmx file and then access it , it was accessible