views:

194

answers:

3

I'm experiencing a strange failure when trying to view my website under IIS. If I create a new ASP.Net web site application, don't modify it at all and run it (F5) the web page shows up with the error:

Compilation Error
Description: An error occurred during the compilation of a resource required to
service this request. Please review the following specific error details and modify
your source code appropriately.

Compiler Error Message: CE29: (CE29) Unable to load assembly C:\Windows\assembly\GAC_64
\System.EnterpriseServices\2.0.0.0__b03f5f7f11d50a3a\System.EnterpriseServices.dll Not
a valid .NET executable (Offset and length were out of bounds for the array or count
is greater than the number of elements from index to the end of the source collection.)

It looks like a .Net configuration problem but I don't know how to fix it. I've got .Net 3.5 SP1 installed and IIS 7.0, running on Vista Home Premium 64-bit. The website is created using Delphi Prism, which runs in the 2008 Visual Studio Shell. I've googled and googled and googled but nothing. Any help greatly appreciated!

A: 

Please check the references of your project. Do you reference System.EnterpriseServices? If not have a look at the machine.config file. Maybe the assembly is referenced there?

Sebastian P.R. Gingter
+1  A: 

Add System.EnterpriseServices(C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\CONFIG) into your reference will solve your problem.

OR

Remove reference from web.config If you are not using this.

Brij
Thanks for replying both of you.It was referenced in the project so I removed it, still the same error. Then I added the following line to machine.config, also didn't help: <add assembly="System.EnterpriseServices, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>At least it works in the cassini development server.
Alan Clark
A: 

You can try removing references to that DLL, but Prism probably put it there for a reason. There are many possible reasons. Maybe you've specified page-level transaction support or you're using COM interop. You may determine the reason by removing the reference temporarily and doing a full rebuild to see what the compiler complains about.

Whatever the reason, if you find that you still need that assembly, you will just have to get the right one in the right place so that IIS can load it.

Try opening the GAC in Windows explorer. I'm not running Vista, so bear with me if your steps differ than mine. Slick START, then type c:\windows\assembly. You'll obviously need permission to view / manage this folder. Find the assembly in question and look at the versions that are available. It looks like the .NET subsystem is trying to jit your application as 64-bit and requires a 64-bit version of this assembly.

If you do not see the appropriate assembly in the GAC (you will likely see other versions), then that probably explains it.

I'm not sure of the solution, but two things I might try are to make sure that you have a 64-bit version of the DLL on your system somewhere and try to install it into the GAC using GACUtil /i. You might also try reconfiguring ASP.Net for IIS using aspnet_regiis.exe -i.

Phil Gilmore