Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Web service Parser Error Message: Could not create type 'xxx'

I am getting a parser error when i try to browse my web service.

Already found so many answers, but none helped me. If anybody can guide me to a helpful link that i might have overlooked, it will be of great help.

Here is the scenario :

I have web service built in VS-2010 (framework 4.0) hosted on IIS 7.5 which uses "ASP.NET v4.0 Classic" app pool. This used to work fine until i reinstalled it. It started showing the Error below


Parser Error

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 'AuthenticateUser'.

Source Error:

Line 1: <%@ WebService Language="C#" CodeBehind="~/App_Code/AuthenticateUser.cs" Class="AuthenticateUser" %>

Source File: /WebService101/Services/AuthenticateUser.asmx Line: 1

Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.1016


Please Help.

like image 813
Bravo Avatar asked Nov 11 '13 14:11

Bravo


2 Answers

I got the same error, in my case resolution was to use full qualified class name (class name with namespace) in the .asmx file.

<%@ WebService Language="C#" CodeBehind="~/App_Code/AuthenticateUser.cs" Class="AuthenticateUser" %>

would become

<%@ WebService Language="C#" CodeBehind="~/App_Code/AuthenticateUser.cs" Class="MyProjectName.AuthenticateUser" %>
like image 82
Pranav Singh Avatar answered Sep 16 '22 14:09

Pranav Singh


Also, check to ensure that build output path is to the "bin\" folder ONLY. A Web Service project cannot use the DLL files generated if they are stuck under "bin\Debug\AnyCPU" or "bin\Release\x86".

A colleague and myself spent 2 hours trying to make a Web Service project work on a new workstation that had worked perfectly on an old machine.

Hope this tip helps someone else using Google!

like image 22
sevenfold Avatar answered Sep 19 '22 14:09

sevenfold