32位和64位以及在Vista64下在IIS7和ASP.NET上迁移DasBlog

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!

构建QuadPowerPC并使用Vista 64进行设置后,下一步是构建DasBlog,以便我继续开发。 我首先安装了 Orcas Visual Studio 2008 。 然后我意识到我还没有在Vista上安装IIS。 h!

使现有的Web应用程序在Vista64上进行编译 (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.

    安装IIS:进入“程序和功能”,然后单击“打开或关闭Windows功能”。 只有某些Vista SKU具有完整的IIS-我相信企业,企业和旗舰版。 Home SKU的版本有限,可以处理3个请求。 可以继续开发,仅此而已。

    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 安装IIS:进入“程序和功能”,然后单击“打开或关闭Windows功能”。 只有某些Vista SKU具有完整的IIS-我相信企业,企业和旗舰版。 Home SKU的 limited version that will serve 3 requests. Enough to develop on, but that's about it. 版本有限,可以处理3个请求。 可以继续开发,仅此而已。
    Windows Features

    The easiest thing for a developer machine is to turn all the checkboxes on from IIS on down.

    对于开发人员而言,最简单的方法是关闭IIS中的所有复选框。

    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.):

    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.):
    IIS 7.0 Detailed Error - 500.0 - Internal Server Error - Windows Internet Explorer (2)
     

    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 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:
    Internet Information Services (IIS) Manager

    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!
    %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.

    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.

  • 选择IIS管道模式: II7下有两种ASP.NET应用程序模式。 有集成管道经典管道。 如果您只是创建一个应用程序并像我一样使用默认设置运行现有应用程序,您可能会看到类似这样的内容(请注意,我可以用...做一些难以置信的详细错误消息,这很热。 ):

    选择IIS管道模式: II7下有两种ASP.NET应用程序模式。 有 集成管道经典管道。 如果您只是创建一个应用程序并像我一样使用默认设置运行现有应用程序,您可能会看到类似这样的内容( 请注意,我可以用...做一些难以置信的详细错误消息,这很热。 ):
    IIS 7.0详细错误-500.0-内部服务器错误-Windows Internet Explorer(2)

    至此,我有两种选择,可以使用此命令行表达式迁移httpModules部分:

     %systemroot%\system32\inetsrv\APPCMD.EXE migrate config "Default Web Site/DasBlog2" 或者,我可以制作一个配置为使用“经典”管道的AppPool-这意味着,它将像以前一样通过此命令行使用HttpModules:
     %systemroot%\system32\inetsrv\APPCMD.EXE migrate config "Default Web Site/DasBlog2" 或者,我可以制作一个配置为使用“经典”管道的AppPool-这意味着,它将像以前一样通过此命令行使用HttpModules:
    Internet信息服务(IIS)管理器

    如果您改变主意,则始终可以在AppPools之间移动应用程序,也可以随意创建任意数量的应用程序。 注意,IIS7风格的管理工具向您显示了所选的管道类型。

    如果仅使用First Option并坚持使用经典模式,则一切正常,我无需在web.config中进行任何更改。 让我们看看如果我选择第二个选项会发生什么...

    %systemroot%\system32\inetsrv\APPCMD.EXE migrate config "Default Web Site/DasBlog2"
    Successfully migrated section "system.web/httpModules".
    Successfully migrated section "system.web/httpHandlers".
    此时,新编写的web.config在底部有一个新部分。
    注意:使用旧式ASP.NET 1.1 browserCaps部分迁移web.configs时,此工具似乎存在一个难以理解的错误。 在这里更多 在运行此工具或任何其他工具之前,请备份您的web.config!
    %systemroot%\system32\inetsrv\APPCMD.EXE migrate config "Default Web Site/DasBlog2"
    Successfully migrated section "system.web/httpModules".
    Successfully migrated section "system.web/httpHandlers".
    此时,新编写的web.config在底部有一个新部分。
    注意:使用旧式ASP.NET 1.1 browserCaps部分迁移web.configs时,此工具似乎存在一个难以理解的错误。 在这里更多 运行此工具或任何其他工具之前,请备份您的web.config!

    请注意,模块和处理程序已移至新的system.webServer部分,模块已标记为managedHandler,并且处理程序具有前提条件,即它们可以在2.0运行时在IntegratedModule中运行。 值得注意的是,

    system.web下的原始httpHandlers部分仍然保留。 这意味着您可以使用此迁移的web.config文件在两种模式下运行,但是如果要切换,则需要使这些部分保持同步-或只是选择一种模式并坚持使用。

    system.web下的原始httpHandlers部分仍然保留。 这意味着您可以使用此迁移的web.config文件在两种模式下运行,但是如果要切换,则需要使这些部分保持同步-或只是选择一种模式并坚持使用。

  • 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.

    转换和编译:完成此迁移后,我在Visual Studio 2008中打开了主要解决方案,并对其进行了转换和编译,没有问题。 大多数2.0项目都可以转换。

  • 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."
    YellowScreenofDeath
    检查您的位数:迁移web.config并在Visual Studio 2008中构建之后,我运行了该应用程序,我得到了黄屏死机告诉我: “ System.BadImageFormatException:无法加载文件或程序集'BasicFrame.WebControls.BasicDatePicker'或它的依赖性之一。”

    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.

    该错误稍显晦涩,但仍然很容易解决。 记住我在Vista64上。 打开正在运行的AppPool的“高级设置”,并注意“启用32位应用程序”选项。 在这一点上,我还有另一种选择。

    Advanced Settings

    I could switch this AppPool to a 32-bit Worker Process. I could tell because itwould say "

    我可以将此AppPool切换为32位工作进程。 我可以说,因为我会说“

    w3wp.exe *32" in TaskManager. Or, I could find out why this is not working and get DasBlog running on 64-bit.

    w3wp.exe * 32 “在TaskManager中。或者,我可以找出为什么此方法不起作用,并使DasBlog在64位上运行。

    I'll choose the latter.

    我选择后者。

    Open up a Visual Studio Command Prompt and run

    打开一个Visual Studio命令提示符并运行

    corflags.exe on the offending assembly.

    问题的程序集上的corflags.exe

    corflags.exe on the offending assembly.
    Administrator Visual Studio 2008 Beta2 x64 Win64 Command Prompt
    问题的程序集上的 corflags.exe

    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.50727CLR Header: 2.5PE        : PE32CorFlags  : 11ILONLY    : 132BIT     : 1Signed    : 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...

    请注意32位:1值。 看起来好像是因为销售该组件的公司使用Xenocode的Postbuild Obfucastor ,并且需要CPU决定。 因此,我付出了代价。 有点la子。 但是,由于Basic Date Picker具有可供下载64位版本,因此很容易解决。 我换了出来,并用鞭子检查了一下。

    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.50727CLR Header: 2.5PE        : PE32CorFlags  : 9ILONLY    : 132BIT     : 0Signed    : 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:

    还在我这儿? 这是有趣的部分。 实际上不是32BIT标志指示程序集是32位还是64位。 它是一个试图“保持”程序集在32位进程中运行的属性。 您有时可以用旗帜来回推动它:

    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.P / Invok进入x64特定的本机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. ;)

      CLR标头:编译器版本... 2.0是.NET 1.1,2.5是.NET 2.0,而3.0是.NET 3.5。 不要问;)
    • PE (Portable Executable): PE32 is 32bit and PE32+ is 64-bit.

      PE(便携式可执行文件):PE32是32位,PE32 +是64位。
    • 32BIT: Are we asking to force 32-bit execution or not?

      32BIT:我们是否要求强制执行32位?

Anyway, I recompiled with the 64-bit version and all is well. I'm now running DasBlog compiled under Visual Studio 2008 on Vista 64 running under IIS7. All very smooth. Here's the "It's Not That Scary™ Summary":

无论如何,我重新编译了64位版本,一切都很好。 我现在正在运行在IIS7下运行的Vista 64上的Visual Studio 2008下编译的DasBlog。 一切都很顺利。 这是“那不是那么可怕™摘要”:

这不是那么可怕™摘要 (It's Not That Scary™ Summary)

  • Install IIS

    安装IIS
    • Pick a Pipeline Mode and Migrate if needed

      选择管道模式并根据需要迁移
  • Compile

    编译
    • Confirm Bitness if Error.

      如果错误,请确认位数。

So, really, just two steps if I'd been on Vista32 and already had IIS7 installed. Thanks to Richard Lander for all his tips and pointers! If there's mistakes in this post, they are mine, and he'll surely show up and correct them in the comments. :)

因此,实际上,如果我去过Vista32并且已经安装了IIS7,则只需两个步骤。 感谢Richard Lander的所有技巧和建议! 如果这篇文章中有错误,那是我的错误,他一定会出现并在评论中纠正它们。 :)

翻译自: https://www.hanselman.com/blog/32bitness-and-64bitness-and-migrating-dasblog-on-iis7-and-aspnet-under-vista64

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值