Monday, August 10, 2009

Could not create type exception in Web Service




Description:
An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.
Parser Error Message: Could not create type ''.
Source Error:
Line 1: <%@ WebService Language="C#" CodeBehind="<filename>.asmx.cs" Class="<classname>" %>

Solution:
1. Put this in web.config within :
<webServices>
<protocols>
<add name="HttpGet"/>
<add name="HttpPost"/>
</protocols>
</webServices>

2. If your web service description is in a DLL then make sure this DLL is in the bin folder of your website.

3. Be sure to be calling the Web Service from the correct folder. Our customer was attempting to call the web service from ~/B/WebServiceName.asmx, instead of ~/A/B/WebServiceName.asmx. So be sure to check for this very simple error.


No comments:

Post a Comment

There was an error in this gadget