web service error 'could not create type 'http://forums.asp.net/t/1328663.aspx/1?web+service+error+could+not+create+type+Tue, 22 Sep 2009 20:50:23 -040013286632659836http://forums.asp.net/p/1328663/2659836.aspx/1?web+service+error+could+not+create+type+web service error 'could not create type ' <p><span>Hello all,</span></p> <p><span>I created a new webservice and chnage the name of class to<strong> <font color="#2b91af" size="2"> RatsUploadWebService and namespace to BHI.Rats and i got this error. </font></strong></span></p> <span><font color="#2b91af" size="2"><strong>Mark up created is </strong><font size="2"></font></font></span><span><font color="#2b91af" size="2"><font size="2"> <p>&lt;%</font><font color="#0000ff" size="2">@</font><font size="2"> </font><font color="#a31515" size="2">WebService</font><font size="2"> </font><font color="#ff0000" size="2">Language</font><font color="#0000ff" size="2">=&quot;C#&quot;</font><font size="2"> </font><font color="#ff0000" size="2">CodeBehind</font><font color="#0000ff" size="2">=&quot;RatsUploadWebService.asmx.cs&quot;</font><font size="2"> </font><font color="#ff0000" size="2">Class</font><font color="#0000ff" size="2">=&quot;BHI.Rats.RatsUploadWebService&quot;</font><font size="2"> %&gt;</p> </font> <p></font>and also the buildaction of .asmx file is set to&nbsp;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.</p> <p>Regards,</p> <p>Rohit </p> <hr width="100%" color="silver" size="1"> <h2><i>Parser Error</i> </h2> <p></span><font face="Arial, Helvetica, Geneva, SunSans-Regular, sans-serif "><b>Description: </b>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. <br> <br> <b>Parser Error Message: </b>Could not create type 'BHI.Rats.RatsUploadWebService'.<br> <br> <b>Source Error:</b> <br> <br> <table class="" width="100%" bgcolor="#ffffcc"> <tbody> <tr> <td class=""><pre class="prettyprint"><pre>Line 1: &lt;%@ WebService Language=&quot;C#&quot; CodeBehind=&quot;RatsUploadWebService.asmx.cs&quot; Class=&quot;BHI.Rats.RatsUploadWebService&quot; %&gt;</pre> <pre></pre></pre></td> </tr> </tbody> </table> </font></p> 2008-10-02T19:37:21-04:002659871http://forums.asp.net/p/1328663/2659871.aspx/1?Re+web+service+error+could+not+create+type+Re: web service error 'could not create type ' <p>Kochar,</p> <p>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.&nbsp; Could you post that for us to look at?</p> <p>James</p> 2008-10-02T19:51:18-04:002659881http://forums.asp.net/p/1328663/2659881.aspx/1?Re+web+service+error+could+not+create+type+Re: web service error 'could not create type ' <p>Thanks james for a quick reply...here is the class code</p> <p>&nbsp;</p> <font color="#0000ff" size="2"> <p>using</font><font size="2"> System;</p> </font><font color="#0000ff" size="2"> <p>using</font><font size="2"> System.Data;</p> </font><font color="#0000ff" size="2"> <p>using</font><font size="2"> System.Web;</p> </font><font color="#0000ff" size="2"> <p>using</font><font size="2"> System.Collections;</p> </font><font color="#0000ff" size="2"> <p>using</font><font size="2"> System.Web.Services;</p> </font><font color="#0000ff" size="2"> <p>using</font><font size="2"> System.Web.Services.Protocols;</p> </font><font color="#0000ff" size="2"> <p>using</font><font size="2"> System.ComponentModel;</p> </font><font color="#0000ff" size="2">namespace</font><font size="2"> BHI.Rats</font><font size="2"> <p>{</p> <p></font><font color="#808080" size="2">///</font><font color="#008000" size="2"> </font><font color="#808080" size="2">&lt;summary&gt;</p> </font><font size="2"> <p></font><font color="#808080" size="2">///</font><font color="#008000" size="2"> Summary description for RatsUploadWebService</p> </font><font size="2"> <p></font><font color="#808080" size="2">///</font><font color="#008000" size="2"> </font><font color="#808080" size="2">&lt;/summary&gt;</p> </font><font size="2"> <p>&nbsp;</p> <p>&nbsp;</p> [</font><font color="#2b91af" size="2">WebService</font><font size="2">(Namespace = </font><font color="#a31515" size="2">&quot;http://tempuri.org/&quot;</font><font size="2">)]</font><font size="2"> <p>[</font><font color="#2b91af" size="2">WebServiceBinding</font><font size="2">(ConformsTo = </font><font color="#2b91af" size="2">WsiProfiles</font><font size="2">.BasicProfile1_1)]</p> [</font><font color="#2b91af" size="2">ToolboxItem</font><font size="2">(</font><font color="#0000ff" size="2">false</font><font size="2">)]</font><font size="2"> <p></font><font color="#0000ff" size="2">public</font><font size="2"> </font><font color="#0000ff" size="2">class</font><font size="2"> </font><font color="#2b91af" size="2">RatsUploadWebService</font><font size="2"> : System.Web.Services.</font><font color="#2b91af" size="2">WebService</p> </font><font size="2"> <p>{</p> [</font><font color="#2b91af" size="2">WebMethod</font><font size="2">]</font><font size="2"></font><font color="#0000ff" size="2">public</font><font size="2"> </font><font color="#0000ff" size="2">bool</font><font size="2"> UploadFile(</font><font color="#0000ff" size="2">byte</font><font size="2">[] byteFileBuffer, </font><font color="#0000ff" size="2">string</font><font size="2"> strFileName)</font><font size="2"> <p>{</p> </font><font color="#0000ff" size="2">return</font><font size="2"> </font><font color="#0000ff" size="2">true</font><font size="2">;</font><font size="2"> <p>}</p> <p>}</p> <p>}</p> </font> 2008-10-02T19:55:15-04:002659950http://forums.asp.net/p/1328663/2659950.aspx/1?Re+web+service+error+could+not+create+type+Re: web service error 'could not create type ' <p>Kochar,</p> <p>Assuming that the cs file name is correct, this sadly all looks right to me.&nbsp; A final possibility is that something is getting cached and so the new class isn't being picked up.&nbsp; You can close down your IDE and go to: C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files&nbsp;on your harddrive.&nbsp; Then find your backup project and delete it.&nbsp; Then try building your app again.&nbsp; It's a longshot, but it's all that I can come up with.</p> <p>James</p> 2008-10-02T20:27:13-04:002659969http://forums.asp.net/p/1328663/2659969.aspx/1?Re+web+service+error+could+not+create+type+Re: web service error 'could not create type ' <p>I did it .to the path </p> <p>C:\WINNT\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files</p> <p>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 .</p> <p>Regards,</p> <p>&nbsp;</p> 2008-10-02T20:39:02-04:002661620http://forums.asp.net/p/1328663/2661620.aspx/1?Re+web+service+error+could+not+create+type+Re: web service error 'could not create type ' <p>Hi,</p> <p>Instead try with some thing like below, use the symbol ~</p> <font color="#ff0000" size="2"> <p>&lt;%<font color="#0000ff" size="2">@</font><font size="2"> </font><font color="#a31515" size="2">WebService</font><font size="2"> </font><font color="#ff0000" size="2">Language</font><font color="#0000ff" size="2">=&quot;C#&quot;</font><font size="2"> </font><font color="#ff0000" size="2">CodeBehind</font><font color="#0000ff" size="2"><strong>=&quot;<font color="#0000ff" size="2">~/App_Code/</font></strong>RatsUploadWebService.asmx.cs&quot;</font><font size="2"> </font><font color="#ff0000" size="2">Class</font><font color="#0000ff" size="2">=&quot;BHI.Rats.RatsUploadWebService&quot;</font><font size="2"> %&gt;</font></font><font color="#0000ff" size="2"></p> </font> 2008-10-03T15:14:23-04:002670516http://forums.asp.net/p/1328663/2670516.aspx/1?Re+web+service+error+could+not+create+type+Re: web service error 'could not create type ' <p>But I dont have the app_code folder in my solution...</p> 2008-10-08T13:14:19-04:002670604http://forums.asp.net/p/1328663/2670604.aspx/1?Re+web+service+error+could+not+create+type+Re: web service error 'could not create type ' <p>Hi,</p> <p>There could be many solutions to this error. Better you&nbsp;mention all details to get solution quickly.</p> <p>Here i am assuming and giving one solution</p> <p><font size="2">The problem is because your application is using ASP.NET V1.1 for the execution of Webservice build in ASP.NET V2.0</font></p> <p><font size="2">1. Open IIS -&gt; Go to the properties of your virtual directory</font></p> <p><font size="2">2. Go ot the ASP.NET Tab</font></p> <p><font size="2">3. Change ASP.NET Version from <strong>1.1</strong> to <strong> 2.0</strong></font></p> <p>I don't know whether which framework your using this is just an assumption. </p> 2008-10-08T13:44:40-04:002670612http://forums.asp.net/p/1328663/2670612.aspx/1?Re+web+service+error+could+not+create+type+Re: web service error 'could not create type ' <p>Hi,</p> <p>Also check the URL: <a href="http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=3914&amp;SiteID=1"> http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=3914&amp;SiteID=1</a>, this might help you.</p> 2008-10-08T13:47:45-04:003419508http://forums.asp.net/p/1328663/3419508.aspx/1?Re+web+service+error+could+not+create+type+Re: web service error 'could not create type ' <p>&nbsp;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:</p> <p><em>&quot;Could not create type 'MyService'&quot;</em></p> <p>My situation occured in upgrading my .asmx web service from VS.NET 2005 to VS.NET 2008 <em>and </em>targeting the new .NET Framework 3.5.</p> <p>I checked <em>all </em>of the reccomendations on all of the sites about ASP.NET in IIS being 1.1...etc and none of them were applicable.&nbsp; This site has a <strong>great </strong>checklist BTW:</p> <p><a href="http://www.cjvandyk.com/blog/Lists/Posts/Post.aspx?ID=133">http://www.cjvandyk.com/blog/Lists/Posts/Post.aspx?ID=133</a></p> <p>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 <em>same </em>error on both.&nbsp; But if I went back and installed the old package made from VS.NET 2005 everything worked fine.&nbsp; Also this obviously had nothing to do with the .NET Framework 3.5 being installed because it is installed on both.</p> <p>I also tried targeting the old 2.0 Framework and rebuilding the setup package, but I had the same results.</p> <p>The solution for me, was to <strong>delete </strong>the web setup project in my web service solution and create a brand new one from scratch.&nbsp; 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.&nbsp; I re-added the primary output, content files, set all of the properties and re-built the web setup package.</p> <p>The install worked and I could then pull up the .asmx web service with no probelms at all.&nbsp; So for me, something was being grandfathered in that old setup package project that when installed <em>even after re-build</em>, was not acting correctly.</p> <p>Hope this helps future readers.</p> 2009-09-22T20:50:23-04:00