• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1296
  • Last Modified:

Parser Error starting web service

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
0
newbieweb
Asked:
newbieweb
  • 12
  • 10
1 Solution
 
surajgupthaCommented:
You migh have forgotten to copy the bin folder contains the DLL when you deployed the webservice. make sure there is a bin folder with a dll (the dll should contains the class WebService1.Service1)

If this dll is present, the DLL may not have the class within it. Did you change the class name?
0
 
newbiewebSr. Software EngineerAuthor 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?
0
 
newbiewebSr. Software EngineerAuthor 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>
0
Cloud Class® Course: Certified Penetration Testing

This CPTE Certified Penetration Testing Engineer course covers everything you need to know about becoming a Certified Penetration Testing Engineer. Career Path: Professional roles include Ethical Hackers, Security Consultants, System Administrators, and Chief Security Officers.

 
surajgupthaCommented:
Update your asmx file with the changed namespace.
0
 
newbiewebSr. Software EngineerAuthor 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".
0
 
surajgupthaCommented:
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" %>
0
 
newbiewebSr. Software EngineerAuthor 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?
0
 
surajgupthaCommented:
>> 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
0
 
newbiewebSr. Software EngineerAuthor Commented:
I need to simplify the constructor down its most simple form.

I'll send it momentarily.
0
 
newbiewebSr. Software EngineerAuthor 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()
        {
        }
    }
}
0
 
surajgupthaCommented:
What are you doing in your constructor?
0
 
surajgupthaCommented:
What is the url to your asmx/ web service?
0
 
surajgupthaCommented:
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" %>
0
 
newbiewebSr. Software EngineerAuthor 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?
0
 
surajgupthaCommented:
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"?
0
 
newbiewebSr. Software EngineerAuthor 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?
0
 
newbiewebSr. Software EngineerAuthor Commented:
Do I need to update something on their end to associate my domain with the ASMX file?
0
 
surajgupthaCommented:
Try deploying it in your local IIS instead of FTPing to ur website everytime
0
 
newbiewebSr. Software EngineerAuthor Commented:
Sounds like a good idea, but I have not done that before.

Could you help me?
0
 
newbiewebSr. Software EngineerAuthor 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?
0
 
surajgupthaCommented:
yes thats right. Try hosting it locally and heck if it works.
0
 
newbiewebSr. Software EngineerAuthor 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
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: MCSA MCSE Windows Server 2012

This course teaches how to install and configure Windows Server 2012 R2.  It is the first step on your path to becoming a Microsoft Certified Solutions Expert (MCSE).

  • 12
  • 10
Tackle projects and never again get stuck behind a technical roadblock.
Join Now