views:

90

answers:

4

Looks like I am struck with a simple issue. I am hosting a precompiled website. It compiles and works fine in my local box. But when I host in IIS it fails with following error.

Could not load type 'MyHero.Home1'.

<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="Home.aspx.vb" Inherits="MyHero.Home1" %>

I can find MyHero.dll in Bin. I have also opend this in object brower and can see that there is a type Home1. MyHero.Home1 type exists and is public. So it is precompiled for sure.Not sure what I am missing Here. This is my first adventure with VB.NET.

This is how code behind looks

Partial Public Class Home1
    Inherits System.Web.UI.Page

Other part of the partial class is designer genrated. and is in Home.aspx.designer.vb

Partial Public Class Home1

I am not uploading code behind as its a precompiled site.

I am using IIS on Windows server 2003. Any pointers would be very helpful.

I can see that Home1. is listed under MyHero Namespace in object explorer. Just to ensure I added namespace Hero around class Home1, tried but same result. also tried removing namespace prefix from aspx page Inherits didnt help.

Is there any known issue with IIS on windows server 2003. Does the order of installation of .NET framework and IIS can impact this ? I am hosting this on freshly installed box. It works fine in my development box.

Thanks to dariom, I have installed fusion log viewer. Here is the Binding log, It doesnt seem to give out much clue. Does it ?

The operation failed.
Bind result: hr = 0x80131018. No description available.

Assembly manager loaded from:  c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\mscorwks.dll
Running under executable  c:\windows\system32\inetsrv\w3wp.exe
--- A detailed error log follows. 
=== Pre-bind state information ===
LOG: User = NT AUTHORITY\NETWORK SERVICE
LOG: DisplayName = MyHero
 (Partial)
LOG: Appbase = file:///C:/Inetpub/wwwroot/cmail/MyHero/
LOG: Initial PrivatePath = C:\Inetpub\wwwroot\cmail\MyHero\bin
LOG: Dynamic Base = c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\2125db8d
LOG: Cache Base = c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\2125db8d
LOG: AppName = 97d7397b
Calling assembly : (Unknown).
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\Inetpub\wwwroot\cmail\MyHero\web.config
LOG: Using host configuration file: \\?\C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet.config
LOG: Using machine configuration file from c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\config\machine.config.
LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
LOG: Attempting download of new URL file:///c:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/Temporary ASP.NET Files/root/2125db8d/97d7397b/MyHero.DLL.
LOG: Attempting download of new URL file:///c:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/Temporary ASP.NET Files/root/2125db8d/97d7397b/MyHero/MyHero.DLL.
LOG: Attempting download of new URL file:///C:/Inetpub/wwwroot/cmail/MyHero/bin/MyHero.DLL.
LOG: Assembly download was successful. Attempting setup of file: C:\Inetpub\wwwroot\cmail\MyHero\bin\MyHero.dll
LOG: Entering download cache setup phase.
ERR: Error extracting manifest import from file (hr = 0x80131018).
ERR: Setup failed with hr = 0x80131018.
ERR: Failed to complete setup of assembly (hr = 0x80131018). Probing terminated.
A: 

Placing the Home1 class in the MyHero namespace would do the trick. IMO.

Gunner 4 Life
I can see that its lited uder MyHero namespace in ObjectExplorer. Just to ensure I added name space tried but same result. also removing namespace prefix from aspx page Inherits didnt help.
A: 

When you say that your app is precompiled... how are you making this so? I am surprised to see the CodeBehind="" attribute in your page directive (in precompiled page). Make sure you don't have a file "Home.aspx.vb" sitting in your virtual directory. All you should need is Inherits="". You could also add the name of the assembly to the inherits value, like: Inherits="MyHero.Home1, MyHero"

matt-dot-net
Looks like there is some progress now. After I add the assembly name to Inherits error reads..Could not load the assembly 'MyHero.dll'. Make sure that it is compiled before accessing the page.I am using the publish option of VS2008 to local directory and moving the files across to server/This assembly is there in Bin folder
matt-dot-net
Yes, Matt its very strnage error. To the best of my logical thinking, it doenst sound to make any sense.
A: 

Your scenario sounds like it should work correctly - I can't see anything wrong with your ASPX and code-behind files.

If you have access to the IIS server you're running your application on, you can try using the Fusion Log Viewer to determine what is happening when the .NET runtime is trying to load your MyHero assembly. This MSDN Magazine article includes details for enabling binder logging and using the Fusion Log Viewer. Hopefully this can uncover why your assembly is not being found.

dariom
I do not have .net framework SDK installed on server. I think Fusion log is a SDK tool ?
Yes, it's part of the .Net Framework SDK. Not sure if it works, but you could try copying the Fusion Log Viewer executable (*fuslogvw.exe*) to the server temporarily to help troubleshooting and then remove it afterwards.
dariom
thanks it took a while to get admin pevilages on box and install SDK. I have posted the log doest seem to make much sense for me. please help me if you get any clue from it.
I think the last 3 lines of the Fusion log file indicate some sort of problem. I've never seen this before and not sure what the solution might be. You could try deleting the contents of your Temporary ASP.NET Folder (*C:\Windows\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files*) and try again. Otherwise I'm not sure why you'd be having problems extracting the assembly's manifest...
dariom
One post suggests that this may has something to do with anti-virus software: http://msmvps.com/blogs/carlosq/archive/2007/03/23/the-strange-case-of-error-80131018-loading-a-visual-studio-add-in.aspxIt's a long shot, but maybe?
dariom
A: 

Guys I am able to resolve this issue. It was a Windows 7 security issue. I was uploading code from Windows 7 laptop to the server. dlls seems to have carried some hidden security permissions.

I have archived the dlls using winrar and extracted it on server. Just to ensure all the security permissions are removed. dlls are loading fine now, just that it haunted us for almost a week.

Thanks for all your help.