After building the QuadPowerPC and getting it setup with Vista 64, the next step was to get DasBlog building so I could continue development. I installed Orcas Visual Studio 2008 first. Then I realized that I hadn't installed IIS on Vista yet. Doh!
Source:
http://www.hanselman.com
Published By
S.G.Godwin Dinesh,MCA
Sr.System Administrator
Getting an existing Web App to Compile on Vista64
- Install IIS: Go
into Programs and Features and click "Turn Windows Features on or off."
Only certain Vista SKUs have Full IIS - I believe Business, Enterprise
and Ultimate. The Home SKUs have a limited version that will serve 3 requests. Enough to develop on, but that's about it.
The easiest thing for a developer machine is to turn all the checkboxes on from IIS on down.
Note: This is a wacky dialog and unless the box is actually CHECKED ("filled" with color doesn't count) then it won't install everything. Open up the tree and make sure. - Pick an IIS Pipeline Mode: There are two modes for ASP.NET apps under II7. There's the integrated pipeline, and the classic pipeline. If
you just create an application and run your existing app with the
defaults, like I did, you'll likely see something like this (Note the incredibly detailed error message that I can ACTUALLY do something with...That's hot.):
At this point I have two choices, I can migrate my httpModules section using this command line expression:%systemroot%\system32\inetsrv\APPCMD.EXE migrate config "Default Web Site/DasBlog2"
Or I can make an AppPool that is configured to use the "classic" pipeline - meaning, it'll use HttpModules just as before with this command line:%systemroot%\system32\inetsrv\APPCMD.EXE set app
"Default Web Site/DasBlog2" /applicationPool:"Classic .NET AppPool"
Either expression needs to be run from an administrator command line.
If you change your mind, you can always move your app between AppPools, or make as many as you like. Notice the IIS7-style admin tool shows you what Pipeline type you've chosen.
If just use the First Option and just stick with classic mode, things will work fine and I don't have to change anything in my web.config. Let's see what happens if I choose The Second Option...%systemroot%\system32\inetsrv\APPCMD.EXE migrate config "Default Web Site/DasBlog2" Successfully migrated section "system.web/httpModules". Successfully migrated section "system.web/httpHandlers".
At this point the newly written web.config has a new section at the bottom.
NOTE: There appears to be an obscure bug with this tool when migrating web.configs with the old-style ASP.NET 1.1 browserCaps section. More on that here. Backup your web.config before running this, or any other tool!
Notice that the modules and handlers have moved to a new system.webServer section, the modules have been marked as managedHandler and the handlers have a preCondition that they are run in integratedModule under the 2.0 runtime. It's worth noting, however, that the original httpHandlers section under system.web remains. This means you can run under both modes with this migrated web.config file, but if you're switching around, you'll need to keep those sections in sync - or, just pick a mode and stick with it.... ... - Convert and Compile: After doing this migration I opened the main solution in Visual Studio 2008 and it converted and compiled, no problem. Most 2.0 projects will convert just fine.
- Check Your Bitness: After migrating the
web.config and building in Visual Studio 2008 I ran the application, I
got the Yellow Screen of Death telling me: "System.BadImageFormatException:
Could not load file or assembly
'BasicFrame.WebControls.BasicDatePicker' or one of its dependencies."
This error is slightly more obscure, but still fairly easily dealt with. Remember that I'm on Vista64. Open up the Advanced Settings of the AppPool you're running in and notice the option "Enable 32-Bit Applications." At this point, I have another choice.
I could switch this AppPool to a 32-bit Worker Process. I could tell because itwould say "w3wp.exe *32" in TaskManager. Or, I could find out why this is not working and get DasBlog running on 64-bit.
I'll choose the latter.
Open up a Visual Studio Command Prompt and run corflags.exe on the offending assembly.
Mine says:D:\dev\DasBlog\lib>corflags BasicFrame.WebControls.BasicDatePicker.dll Microsoft (R) .NET Framework CorFlags Conversion Tool. Version 3.5.20706.1 Copyright (c) Microsoft Corporation. All rights reserved. Version : v2.0.50727 CLR Header: 2.5 PE : PE32 CorFlags : 11 ILONLY : 1 32BIT : 1 Signed : 1
Notice the 32bit: 1 value. Looks like because the company that sells this assembly used Xenocode's Postbuild Obfucastor and it requires a CPU decision. Consequently I pay the price. Kind of lame.
However, easily solved because Basic Date Picker has a 64-bit version available for download. I swap it out and check it with corflags...
D:\dev\DasBlog\lib>corflags BasicFrame.WebControls.BasicDatePicker.dll Microsoft (R) .NET Framework CorFlags Conversion Tool. Version 3.5.20706.1 Copyright (c) Microsoft Corporation. All rights reserved. Version : v2.0.50727 CLR Header: 2.5 PE : PE32 CorFlags : 9 ILONLY : 1 32BIT : 0 Signed : 1
Still with me? Here's the funny part. It's not the 32BIT Flag that actually indicates if the assembly is 32bit or 64bit. It a property that tries to "insist" that the assembly run in a 32-bit process. You can, sometimes force it back and forth with corflags:
D:\dev\DasBlog\lib>corflags.exe /32bit+ BasicFrame.WebControls.BasicDatePicker.dll Microsoft (R) .NET Framework CorFlags Conversion Tool. Version 3.5.20706.1 Copyright (c) Microsoft Corporation. All rights reserved. corflags : error CF012 : The specified file is strong name signed. Use /Force to force the update. D:\dev\DasBlog\lib>corflags.exe /32bit+ BasicFrame.WebControls.BasicDatePicker.dll /force Microsoft (R) .NET Framework CorFlags Conversion Tool. Version 3.5.20706.1 Copyright (c) Microsoft Corporation. All rights reserved. corflags : warning CF011 : The specified file is strong name signed. Using /Force will invalidate
the signature of this image and will require the assembly to be resigned.
But I can't because it's strong named and I don't have the key to sign it with, and I'm getting a little far down a silly road. Why would you want to compile a .NET assembly specific to 32-bit or X64, or IA? Usually because you're P/Invok'ing into a x64 specific native dll.
The interesting things that corflags tell us are these:- CLR Header: The compiler version...2.0 is .NET 1.1, 2.5 is .NET 2.0 and 3.0 is .NET 3.5. Don't ask. ;)
- PE (Portable Executable): PE32 is 32bit and PE32+ is 64-bit.
- 32BIT: Are we asking to force 32-bit execution or not?
It's Not That Scary™ Summary
- Install IIS
- Pick a Pipeline Mode and Migrate if needed
- Compile
- Confirm Bitness if Error.
Source:
http://www.hanselman.com
Published By
S.G.Godwin Dinesh,MCA
Sr.System Administrator
No comments:
Post a Comment