I created a new webservice and chnage the name of class to
RatsUploadWebService and namespace to BHI.Rats and i got this error.
Mark up created is
<%
@ WebService
Language="C#"
CodeBehind="RatsUploadWebService.asmx.cs"
Class="BHI.Rats.RatsUploadWebService" %>
and also the buildaction of .asmx file is set to Content and .asmx.cs is set to compile. What could be the possible solution to the error?? I am using inbuilt server of Visual 2005 and not IIS.
Regards,
Rohit
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 'BHI.Rats.RatsUploadWebService'.
Source Error:
Line 1: <%@ WebService Language="C#" CodeBehind="RatsUploadWebService.asmx.cs" Class="BHI.Rats.RatsUploadWebService" %>
The markup looks right. My best guess would be that you have a typo somewhere in the class file, either in the namespace or class name. Could you post that for us to look at?
James
James Ashley, Imaginative Universal, Inc
MVP Client App Dev
Assuming that the cs file name is correct, this sadly all looks right to me. A final possibility is that something is getting cached and so the new class isn't being picked up. You can close down your IDE and go to: C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary
ASP.NET Files on your harddrive. Then find your backup project and delete it. Then try building your app again. It's a longshot, but it's all that I can come up with.
James
James Ashley, Imaginative Universal, Inc
MVP Client App Dev
I need to add the solution I found for this issue for future readers, as this is one of the 1st posts that comes up when searching for the following exception:
"Could not create type 'MyService'"
My situation occured in upgrading my .asmx web service from VS.NET 2005 to VS.NET 2008
and targeting the new .NET Framework 3.5.
I checked all of the reccomendations on all of the sites about ASP.NET in IIS being 1.1...etc and none of them were applicable. This site has a
great checklist BTW:
Anyways, I was able to install the web setup package created from Visual Studio 2008 both on my development machine and test server producing the
same error on both. But if I went back and installed the old package made from VS.NET 2005 everything worked fine. Also this obviously had nothing to do with the .NET Framework 3.5 being installed because it is installed on both.
I also tried targeting the old 2.0 Framework and rebuilding the setup package, but I had the same results.
The solution for me, was to delete the web setup project in my web service solution and create a brand new one from scratch. Notice how in VS 2008 there is a target framework dropdown; I am not sure if that had anything to do with it, but
I made sure 3.5 was selected. I re-added the primary output, content files, set all of the properties and re-built the web setup package.
The install worked and I could then pull up the .asmx web service with no probelms at all. So for me, something was being grandfathered in that old setup package project that when installed
even after re-build, was not acting correctly.
Kochar_Rohit
0 Points
7 Posts
web service error 'could not create type '
Oct 02, 2008 07:37 PM|LINK
Hello all,
I created a new webservice and chnage the name of class to RatsUploadWebService and namespace to BHI.Rats and i got this error.
Mark up created is<%
@ WebService Language="C#" CodeBehind="RatsUploadWebService.asmx.cs" Class="BHI.Rats.RatsUploadWebService" %> and also the buildaction of .asmx file is set to Content and .asmx.cs is set to compile. What could be the possible solution to the error?? I am using inbuilt server of Visual 2005 and not IIS.Regards,
Rohit
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 'BHI.Rats.RatsUploadWebService'.
Source Error:
vgiambattist...
Star
8370 Points
1283 Posts
Re: web service error 'could not create type '
Oct 02, 2008 07:51 PM|LINK
Kochar,
The markup looks right. My best guess would be that you have a typo somewhere in the class file, either in the namespace or class name. Could you post that for us to look at?
James
MVP Client App Dev
Kochar_Rohit
0 Points
7 Posts
Re: web service error 'could not create type '
Oct 02, 2008 07:55 PM|LINK
Thanks james for a quick reply...here is the class code
using
System;using
System.Data;using
System.Web;using
System.Collections;using
System.Web.Services;using
System.Web.Services.Protocols;using
System.ComponentModel; namespace BHI.Rats{
/// <summary> /// Summary description for RatsUploadWebService /// </summary>
[WebService(Namespace = "http://tempuri.org/")][
WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)] [ToolboxItem(false)] public class RatsUploadWebService : System.Web.Services.WebService{
[WebMethod]public bool UploadFile(byte[] byteFileBuffer, string strFileName){
return true;}
}
}
vgiambattist...
Star
8370 Points
1283 Posts
Re: web service error 'could not create type '
Oct 02, 2008 08:27 PM|LINK
Kochar,
Assuming that the cs file name is correct, this sadly all looks right to me. A final possibility is that something is getting cached and so the new class isn't being picked up. You can close down your IDE and go to: C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files on your harddrive. Then find your backup project and delete it. Then try building your app again. It's a longshot, but it's all that I can come up with.
James
MVP Client App Dev
Kochar_Rohit
0 Points
7 Posts
Re: web service error 'could not create type '
Oct 02, 2008 08:39 PM|LINK
I did it .to the path
C:\WINNT\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files
i deleted the folder and build it again. I got the same error and also now i dont see the folder in Temporary asp.net folder .
Regards,
naveen_j80
Member
690 Points
122 Posts
Re: web service error 'could not create type '
Oct 03, 2008 03:14 PM|LINK
Hi,
Instead try with some thing like below, use the symbol ~
<%@ WebService Language="C#" CodeBehind="~/App_Code/RatsUploadWebService.asmx.cs" Class="BHI.Rats.RatsUploadWebService" %>
Kochar_Rohit
0 Points
7 Posts
Re: web service error 'could not create type '
Oct 08, 2008 01:14 PM|LINK
But I dont have the app_code folder in my solution...
naveen_j80
Member
690 Points
122 Posts
Re: web service error 'could not create type '
Oct 08, 2008 01:44 PM|LINK
Hi,
There could be many solutions to this error. Better you mention all details to get solution quickly.
Here i am assuming and giving one solution
The problem is because your application is using ASP.NET V1.1 for the execution of Webservice build in ASP.NET V2.0
1. Open IIS -> Go to the properties of your virtual directory
2. Go ot the ASP.NET Tab
3. Change ASP.NET Version from 1.1 to 2.0
I don't know whether which framework your using this is just an assumption.
naveen_j80
Member
690 Points
122 Posts
Re: web service error 'could not create type '
Oct 08, 2008 01:47 PM|LINK
Hi,
Also check the URL: http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=3914&SiteID=1, this might help you.
atconway
All-Star
16846 Points
2756 Posts
Re: web service error 'could not create type '
Sep 22, 2009 08:50 PM|LINK
I need to add the solution I found for this issue for future readers, as this is one of the 1st posts that comes up when searching for the following exception:
"Could not create type 'MyService'"
My situation occured in upgrading my .asmx web service from VS.NET 2005 to VS.NET 2008 and targeting the new .NET Framework 3.5.
I checked all of the reccomendations on all of the sites about ASP.NET in IIS being 1.1...etc and none of them were applicable. This site has a great checklist BTW:
http://www.cjvandyk.com/blog/Lists/Posts/Post.aspx?ID=133
Anyways, I was able to install the web setup package created from Visual Studio 2008 both on my development machine and test server producing the same error on both. But if I went back and installed the old package made from VS.NET 2005 everything worked fine. Also this obviously had nothing to do with the .NET Framework 3.5 being installed because it is installed on both.
I also tried targeting the old 2.0 Framework and rebuilding the setup package, but I had the same results.
The solution for me, was to delete the web setup project in my web service solution and create a brand new one from scratch. Notice how in VS 2008 there is a target framework dropdown; I am not sure if that had anything to do with it, but I made sure 3.5 was selected. I re-added the primary output, content files, set all of the properties and re-built the web setup package.
The install worked and I could then pull up the .asmx web service with no probelms at all. So for me, something was being grandfathered in that old setup package project that when installed even after re-build, was not acting correctly.
Hope this helps future readers.