You must Sign In to post a response.
  • Category: ASP.NET

    Could not create type 'test' while accessing hosted service

    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. Could not create type 'Test'.

    Line 1: <%@ WebService Language="C#" CodeBehind="~/App_Code/Test.cs" Class="Test" %>
    I have done one simple webservice not wcf service.It is working fine on local but while hosting on server,getting above error.In IIS of server already created virtual directory for website,inside that I uploaded one folder.That folder contain my webservice,app_code and webconfig.I have created service in framework 4.0.When error come on server,last line shows Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.33440.Means both version are same on local and server.How to handle this?
  • #768169
    There are couple of ways to resolve this error, check out below work around
    1. Please check whether all your dll's are present in the web service folder. i was able to find this with the help of a tool called "Beyond Compare". where i compared older working copy of Web service directory to the new one
    2. Other way to resolve this error is 'use full qualified class name (class name with namespace) in the .asmx file.'
    see below code snippet

    instead of
    < %@ WebService Language="C#" CodeBehind="~/App_Code/AuthenticateUser.cs" Class="AuthenticateUser" %>
    use it like
    <%@ WebService Language="C#" CodeBehind="~/App_Code/AuthenticateUser.cs" Class="MyProjectName.AuthenticateUser" %>

    check below link for more details
    http://stackoverflow.com/questions/888794/web-service-error-could-not-create-type-when-calling-service-from-ajax

    Thanks
    Koolprasd2003
    Editor, DotNetSpider MVM
    Microsoft MVP 2014 [ASP.NET/IIS]

  • #768172
    I have created web application called SampleWebservice,inside that I have added one webservice called FirstService.When I run on localhost it works fine

    Folder Structure is

    SampleWebservice folder : SampleWebservice sln file
    SampleWebservice folder : Bin
    :Obj
    :FirstService.asmx
    :FirstService.asmx.cs
    Firstservice class had namespace SampleWebservice
    My FirstService.asmx contain :
    <%@ WebService Language="C#" CodeBehind="FirstService.asmx.cs" Class="SampleWebservice.FirstService" %>
    I converted web application to virtual directory by clicking property of it. I am able to to see my virtual dirctory from IIS,from content view if I click on browse ,working fine

    Url : http://localhost/SampleWebservice/FirstService.asmx
    I want to add this SampleWebservice folder

    SampleWebservice folder : Bin
    :Obj
    :FirstService.asmx
    :FirstService.asmx.cs
    to another folder named MainWebsite.I have copied SampleWebservice folder to MainWebsite folder.Here I get exception

    I was trying url like this : http://localhost/MainWebsite/SampleWebservice/FirstService.asmx so I removed namespace from FirstService class as well as asmx file

    still not working so again modified

    <%@ WebService Language="C#" CodeBehind="~/FirstService.asmx.cs" Class="FirstService" %>
    <%@ WebService Language="C#" CodeBehind="MainWebsite/FirstService.asmx.cs" Class="FirstService" %> Nothing worked out for me.No success.How to handle this?


  • Sign In to post your comments