Archive

Archive for March 7, 2012

“Could not create type” error while browsing a web service

Hi,

You may come across below error after you deploy a web service application on IIS and try to browse the .asmx file.

Could not create type error

Could not create type error

Fix :-

Below are few reasons that cause this issue

  • Check your Application Pool of your hosted site is of .Net Framework 2.0 or higher
App pool framework

App pool framework

  • Verify all your web service  methods preceded with [WebMethod] tag
  • Add a Namespace tag to your web service class; (It should mostly resolve the problem)
    • Go to “.asmx.cs” file and set Namespace & Name
    • ‘Name’ value should match with your class name; In my case its “MyService”

[WebService(Namespace = “MyDomain”, Name = “MyService“)]

public MyService TelefonicService : System.Web.Services.WebService

{

[WebMethod]

public string HelloWorld()

{

return “Hello World”;

}

}

  • Clean, rebuild and deploy the web service

Below is a useful article that talks about the same issue

Link

Hope it helps 🙂