Solved

Could not create type 'xx.xx'

Posted on 2009-05-14
30
1,372 Views
Last Modified: 2012-08-14
I have been looking at solutions for the last 2 days on how to correct "Parser Error:  Could not create type" message with no luck.

I recently re-installed Windows Server 2003 with IIS and am no longer able to get my web services / websites to run on this server.  It also works uncompiled on my local machine.

I have copied the web service files to another production server and they work fine.  This is what I have tried so far:

1.  Deleted my bin directory, rebuilt project (CTL-SHIFT-B), published.
2.  Deleted my ASP.NET temporary files directory, rebuilt project (CTL-SHIFT-B), published.  
3.  Checked to make sure that the build web properties tab output path was set to "bin\".
4.  Made sure that the Namespace was included with the service.  (Please see code example below)
5.  Checked to make sure that .NET 2.0 was allowed on IIS.
6.  Made sure that the permissions were identical to the working production server.
7.  Uninstalled all .NET Frameworks, re-booted, re-installed all .NET Frameworks.

One other weird issue with this is that one of my previous web services that was created prior to the server being re-installed is still working, however; if I rebuild that web services project and deploy it, it will also not work.

I have created an App_Code directory and placed the code directory in it and it does work, however; this is not the solution I need since my websites are also having the same problem.
namespace Test

{

    [WebService(Namespace = "http://tempuri.org/")]

    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]

    [ToolboxItem(false)]

    public class Test1 : System.Web.Services.WebService

.....
 

<%@ WebService Language="C#" CodeBehind="Test1.asmx.cs" Class="Test.Test1" %>

Open in new window

0
Comment
Question by:ednote
  • 19
  • 11
30 Comments
 
LVL 39

Expert Comment

by:abel
Comment Utility
What is the actual type that cannot be created? Do you get the same error when you use a mini test website? You say:

> re-installed all .NET Frameworks.
do you mean that you did so, including all updates? You mention .NET 2.0, is your project really .NET 2.0 or is it actually .NET 3.5 (you won't be the first where that happened).

If you check your references, are there any external references that actually need installing to work correctly? Com interfaces?
0
 

Author Comment

by:ednote
Comment Utility
Attached, is the response from performing a min test website.

Yes, I have also installed all service packs for the .NET Frameworks.  My project is using the .NET 2.0 Framework, not the 3.5.

No, all of the references are internal.  

Note, that this works correctly on an older build, however; if I open the web services project and recompile, it does not work on this server.
Untitled.jpg
0
 
LVL 39

Expert Comment

by:abel
Comment Utility
sounds to me that the bin directory is somehow not published...  You say "published". Can you, for a test, rebuild and publish locally, then use FTP to publish the whole site?

The error basically means that the dlls, which are given random names, cannot be found. Why that is, I don't know (yet). It may mean that we will have to do quite some research to find it out.
0
 
LVL 39

Expert Comment

by:abel
Comment Utility
Hmm, no, the names are not mangled when you use a simple webservice. But that's not important here. I just managed to reproduce your problem by simply renaming my bin file fo a similar hello world web service. Not sure if this helps you, but it does pinpoint the direction in which we need to search.
0
 
LVL 39

Expert Comment

by:abel
Comment Utility
Interestingly enough, the error is totally different if it were the result of access restrictions. So we can rule that one out. See the screenshot of what happens when the server does not have access to the bin directory.

ScreenShot277.png
0
 

Author Comment

by:ednote
Comment Utility
I have rebuilt and published the project locally and the web services project has the same parser error.
0
 
LVL 39

Expert Comment

by:abel
Comment Utility
Can you check the bin directory and if the file Webservice1.dll is in that directory? The normal location for the bin is directly under the root of the web service web site.
0
 
LVL 39

Expert Comment

by:abel
Comment Utility
One more thing comes to mind, actually. How did you create the web application on the server? Did you do that from IIS or from Visual Studio? Because if you did it from IIS, you may have checked the wrong checkboxes or options. Can you try, when publishing from Visual Studio, to create a new web application from that screen? (see screenshot)

ScreenShot278.png
0
 

Author Comment

by:ednote
Comment Utility
Abel, I actually ended up publishing that web services project in the wrong directory.

I re-published it locally in the correct directory and it is now working correctly.  I published the actual web service project that I am having issues with to my local inetpub directory and it is also working.

When I transfer the files over to the test web server, it gives me parser error still.
0
 
LVL 39

Expert Comment

by:abel
Comment Utility
Just thinking, that's probably not going to work for your Win2K3 installation. IIS6 is totally different from IIS7....
0
 

Author Comment

by:ednote
Comment Utility
Could you suggest another way to publish this in order for the web server on IIS6 to work correctly?  
0
 
LVL 39

Expert Comment

by:abel
Comment Utility
Iirc, the following screen must be set correctly to work (I don't have a good test env with Win2k3, only some running systems that I can browse but not change). On newer IIS's, this screen is gone completely, so you do not have to worry then.

Also, you should publish to the Web Site, not to the Virtual Directory.

ScreenShot279.png
0
 
LVL 39

Expert Comment

by:abel
Comment Utility
> Could you suggest another way to publish this in order for the web server on IIS6 to work correctly?

well, that's basically what I'm trying to find out. The crazy thing is, I've been at the exact same situation, but I can't remember how I fixed it.... Normally I write them down, this time I didn't.
0
 
LVL 39

Expert Comment

by:abel
Comment Utility
I'm just wondering, how are you publishing? On this thread, someone (half way down) starts publishing using the Publish command in Visual Studio and then it suddenly works. If you haven't done so, can you try it?
0
 
LVL 39

Expert Comment

by:abel
Comment Utility
Another hint, at the bottom of that same thread: "I had strong names in each of my projects, once I removed them, it worked great!". Can you try that, too?
0
What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

 

Author Comment

by:ednote
Comment Utility
I went into IIS and confirmed that the above options are selected.  Currently, how I have this server setup is only for Virtual Directories.  I am not creating any websites since this is for local intranet tests only.

A previous web service project that was compiled prior to the server being redone is working correctly.  Is there any files that you think I might be missing on the re-installed server.  (For example:  Front Page Extensions?)
0
 
LVL 39

Expert Comment

by:abel
Comment Utility
Even more to the point, check this post, it seems to talk about you: http://realnero.blogspot.com/2008/08/how-do-i-solve-could-not-create-type.html. Maybe you've done all that already, but it doesn't hurt to check it out...
0
 
LVL 39

Expert Comment

by:abel
Comment Utility
One more hint, from that thread: "Perfect! Setting 'content' on .asmx file and 'compile' on .asmx.cs file worked for me. ".

From what you just said, it seems that your IIS settings are correct. Let's focus on the other side now.
0
 

Author Comment

by:ednote
Comment Utility
I tried publishing from the "Publish" command and it is still not working.

I checked my assemblyinfo.cs file, but I am not using strong names.

I also clicked on the above link in regards to different solutions that may cause the "Parser Error" and I actually ran across that website this morning and already checked all of those items with no luck.

The .asmx file is set to content and the .cs file is set to compile as included in your above request.
0
 
LVL 39

Expert Comment

by:abel
Comment Utility
This may seem silly, but since you said that you reinstalled ALL .NET frameworks: did you accidentally include .NET 1.1? Can you check the properties of the ASP.NET tab (or Documents > Configuration? In the screenshot, I just found out that for one of our test servers, the settings are incorrect, even though that some other sites do work correctly there.

I'm a bit surprised that the direct Publish method doesn't work. The server you see in the screenshot has these settings, but when publishing with Publish, it works. The only difference is, perhaps, that I published to a site and not to a virtual dir.



ScreenShot280.png
0
 

Author Comment

by:ednote
Comment Utility
I did install .NET 1.1 back on the server as well, but the 2.0 option is selected in the ASP.NET tab and I have also looked at the Application Configuration screen and it is pointing to version 2 as shown in the below screenshot.
AppConfiguration.png
0
 
LVL 39

Expert Comment

by:abel
Comment Utility
This is getting quite nasty altogether and I'm starting to run out of options that I can offer you. You seem to have done what you should've done. You googled the net for your error and tried the proposed steps to solve it. You do not use strong naming, your bin directory is filled with the correct DLLs, your IIS settings are correct etc etc.

There's definitely something seriously wrong, but what...

Thinking out loud here: have you tried a full publish, i.e., using the Publish Web wizard of VS with the options "All files in the source project folder" selected.

Have you tried publishing, possibly to another location, an ASP.NET web application (as opposed to web services). Maybe you said so, but then I forgot. And, if that does not work, can you run any simple .NET 2.0 / 3.5 application, just to be positive about .NET 2.0 / 3.5 working correctly.
0
 

Author Comment

by:ednote
Comment Utility
I have just performed a full publish on the project and am still receiving the error.  I also created a test website and published that to the server and I am receiving the attached error.  It is still a parser error, however; it is indicating that it could not load the assembly.  

I also published directly to the inetpub directory on that server also with no luck.  
Test-Website-Error.png
0
 

Author Comment

by:ednote
Comment Utility
In regards to the .NET 2.0 test, I have another web services project on this server and it works properly.  If I recompile the project, however; it doesn't.  That makes me think that is has something to do with the compilation process when the files get transferred over to the server.
0
 
LVL 39

Expert Comment

by:abel
Comment Utility
ah, yes, I remember that you said that earlier.

This new web site does seem to give some information again and it does point to the bin again. I assume you have checked whether App_Web_tc-eu_is is available? I find it a rather strange name, my applications do not contain so many dashes/underscores, but that can be a coincidence.
0
 

Author Comment

by:ednote
Comment Utility
Yes, the .dll file is located in the bin directory and is spelt correctly.  

Also, keep in mind that I have moved the files over to another server on our network and it works correctly there with no issues.  I am just curious if there is some sort of setting that is not set correctly on the server that I am trying to run it on.
0
 
LVL 39

Assisted Solution

by:abel
abel earned 500 total points
Comment Utility
I'm afraid I'm running a bit out of ideas. It has repeatedly been reported that ASP.NET 1.1 bites ASP.NET 2.xxx versions and that they cannot co-exist. If you don't have an compelling reason to use 1.1, my (perhaps last) suggestion would be to remove it and after removal (which may not be complete...) reinstall the other .NET runtimes.

Today I saw another post where a user complaint about machine.config loaded instead of the local app.config. If your web.config isn't loaded but the machine.config, for whatever reason, that may be yet another angle to search for a solution.

If these do not help, I'm afraid all I can suggest is making a service request to Microsoft (and show them this or the other threads, too).
0
 
LVL 39

Expert Comment

by:abel
Comment Utility
Btw, you are not alone, but this guy just forgot to upload the DLL: http://www.experts-exchange.com/Programming/Languages/.NET/ASP.NET/Q_24410721.html#a24391282
0
 

Accepted Solution

by:
ednote earned 0 total points
Comment Utility
Abel, I just wanted to let you know how I ended up fixing this issue.  I ended up re-formatting the computer again and re-installing Windows Server 2003.  After the installation was completed, I did not join it to the domain or run any service packs.  I installed .NET 2.0 Framework and IIS and then tried to run the web services project and it worked.

I then started running the updates and everything ended up working out great.  It must have been a corrupted file somewhere.  I did notice that Microsoft released a new .NET Framework update on Tuesday, May 19, 2009, and that was the day that I re-installed Windows the first time, so that could have had something to do with it.

Thanks again for your assistance.
0
 
LVL 39

Expert Comment

by:abel
Comment Utility
It's good to hear that you found a solution, it is a pity that it happens to be that infamous "format + reinstall windows" thingy again. It's apparently in the air, because my Apache 2.2 installation doesn't want to start anymore since my last restart of Windows Vista, but that's one without a solution so far (just downloaded the source, seems to be the only option, and something you could never do with IIS ;-)
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
Prologue It is often required to host multiple websites on a single instance of IIS, mostly in development environments instead of on production servers. I am sure it is not much a preferred solution on production servers but this is at least a pos…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now