We help IT Professionals succeed at work.

Parser Error starting web service

1,332 Views
Last Modified: 2013-12-17
Any ideas?  Here's what gets displayed in my browser.

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 'WebService1.Service1'.

Source Error:
Line 1:  <%@ WebService Language="C#" CodeBehind="Service1.asmx.cs" Class="WebService1.Service1" %>

Source File: E:\web\mydomain\htdocs\Service1.asmx    Line: 1

--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:1.1.4322.2407; ASP.NET Version:1.1.4322.2407
Comment
Watch Question

Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION
curiouswebsterSoftware Engineer

Author

Commented:
The bin folder and the DLL are there.  I can get it to work on another system.  And I changed the namespace to match the URL for this particular domain.

What else could it be?
curiouswebsterSoftware Engineer

Author

Commented:
does web.config look okay?

<?xml version="1.0"?>

<configuration>
 
    <appSettings/>
 
    <system.web>
        <!--
            Set compilation debug="true" to insert debugging
            symbols into the compiled page. Because this
            affects performance, set this value to true only
            during development.
        -->
        <compilation debug="true" />
        <!--
            The <authentication> section enables configuration
            of the security authentication mode used by
            ASP.NET to identify an incoming user.
        -->
        <authentication mode="Windows" />
        <!--
            The <customErrors> section enables configuration
            of what to do if/when an unhandled error occurs
            during the execution of a request. Specifically,
            it enables developers to configure html error pages
            to be displayed in place of a error stack trace.

        <customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
            <error statusCode="403" redirect="NoAccess.htm" />
            <error statusCode="404" redirect="FileNotFound.htm" />
        </customErrors>
        -->
    </system.web>
</configuration>
Update your asmx file with the changed namespace.
curiouswebsterSoftware Engineer

Author

Commented:
Do you mean update the web reference?  I do that in the program which uses it, but that generates an error too.

Please be more specific about "Update your asmx file".
The asmx file of your web service should be changed .
Replace WebService1.Service1with the updated class and refresh your proxy
%@ WebService Language="C#" CodeBehind="Service1.asmx.cs" Class="WebService1.Service1" %>
curiouswebsterSoftware Engineer

Author

Commented:
I recompile my web service and FTP the bin directory, the Service1.asmx and the web.config file to the root directory of my website.

Is this what you mean?  Or were you describing something else?

Do I need to FTP my .cs file as well?
>> Could not create type 'WebService1.Service1'.

This would occur only if this class isnt found or if there is something in the constructor of the class that is making it fail
curiouswebsterSoftware Engineer

Author

Commented:
I need to simplify the constructor down its most simple form.

I'll send it momentarily.
curiouswebsterSoftware Engineer

Author

Commented:
The attached code still fails, even though nothing happens in the constructor.  


using System;
using System.Data;
using System.Web;
using System.Collections;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.ComponentModel;

namespace WebService1
{
    /// <summary>
    /// Summary description for Service1
    /// </summary>
    [WebService(Namespace = "http://texselogic.com/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    [ToolboxItem(false)]
    public class Service1 : System.Web.Services.WebService
    {
        private Handles handles = null;

        public Service1()
        {
        }

        [WebMethod]
        public string HelloWorld()
        {
            return "Hello World!";
        }

        [WebMethod]
        public string GetVersion()
        {
            return "1.0.01";
        }

        [WebMethod]
        public void Send()
        {
        }
    }
}
What are you doing in your constructor?
What is the url to your asmx/ web service?
I pasted the same code in my solution in vs2005 after removing "private Handles handles = null;" and it worked perfectly fine :)

using System;
using System.Data;
using System.Web;
using System.Collections;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.ComponentModel;

namespace WebService1
{
    /// <summary>
    /// Summary description for Service1
    /// </summary>
    [WebService(Namespace = "http://texselogic.com/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    [ToolboxItem(false)]
    public class Service1 : System.Web.Services.WebService
    {
        public Service1()
        {
        }

        [WebMethod]
        public string HelloWorld()
        {
            return "Hello World!";
        }

        [WebMethod]
        public string GetVersion()
        {
            return "1.0.01";
        }

        [WebMethod]
        public void Send()
        {
        }
    }
}


This is my ASMX file <%@ WebService Language="C#" CodeBehind="~/App_Code/Service.cs" Class="WebService1.Service1" %>
curiouswebsterSoftware Engineer

Author

Commented:
>> What are you doing in your constructor?

It's blank.  I deleted the one object as a test, but it still fails.

public Service1()
{
}

>> What is the url to your asmx/ web service?

it's texselogic.com

am I missing something?
1) The same code worked for me like i have said in my previous post
2) Try deploying it in your local IIS instead of FTPing to ur website everytime
3) Generallty curious, are you trying to learn web services or trying to implement something ? If so what are u trying to implement"?
curiouswebsterSoftware Engineer

Author

Commented:
Mine still does not work, even with Handles removed.

Do I need to put the .cs file on the website? My ASMX file:
<%@ WebService Language="C#" CodeBehind="Service1.asmx.cs" Class="WebService1.Service1" %>

Maybe I will get a new ISP.  This is DiscountASP.Net and it's a website I have used many years as a testing site for web services.  Could there be something residual?  Is there anything else I should try before throwing in the towel?
curiouswebsterSoftware Engineer

Author

Commented:
Do I need to update something on their end to associate my domain with the ASMX file?
Try deploying it in your local IIS instead of FTPing to ur website everytime
curiouswebsterSoftware Engineer

Author

Commented:
Sounds like a good idea, but I have not done that before.

Could you help me?
curiouswebsterSoftware Engineer

Author

Commented:
I do run it in my Visual Studio 2005 environment, but you mean to deploy it so that the web service is hosted locally, right?
yes thats right. Try hosting it locally and heck if it works.
curiouswebsterSoftware Engineer

Author

Commented:
Let me put this effort on hold.  I just started with a new ISP and hope I can make it work right out of the box.  Let me close this question and start a new one if my new ISP doesn't work.

thanks for all the help!

NBW
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.