You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

求助:IIS 2.0环境下.NET 2.0编译程序集加载失败问题

Fixing "Could not load the assembly 'App_Web_xxxxxxxxx'" After Downgrading to .NET Framework 2.0

Hey there, I’ve run into identical headaches when dealing with legacy IIS setups and .NET version downgrades—let’s break down the most reliable fixes step by step:

1. Clear ASP.NET Temporary Compilation Files

The App_Web_xxxxxxxxx assemblies are dynamically generated by ASP.NET, and leftover files from your original .NET 4.0 deployment are almost certainly causing conflicts. Here’s how to clean them up:

  • Navigate to the .NET 2.0 temp files directory: C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files
  • Locate the folder tied to your web application and delete all its contents (or the entire folder)
  • Restart IIS with this command in Command Prompt: iisreset

2. Confirm All Assemblies Target .NET 2.0

It’s easy to overlook a project or referenced DLL still clinging to .NET 4.0:

  • In Visual Studio, right-click each project in your solution → Properties → Application
  • Double-check that Target framework is set to .NET Framework 2.0
  • Audit all referenced DLLs: remove any that are .NET 4.0-specific (like System.Core v4.0+) and replace them with 2.0-compatible versions if necessary
  • Recompile the entire solution and redeploy every updated DLL to the server’s bin directory

3. Update Web.config for .NET 2.0 Compatibility

Your original web.config was built for .NET 4.0—strip out incompatible settings:

  • Find the <compilation> node under <system.web> and update it to:
    <compilation debug="false" targetFramework="2.0">
      <!-- Remove any .NET 4.0-only compiler configurations here -->
    </compilation>
    
  • Delete .NET 4.0-specific sections, such as:
    • <runtime> nodes with assembly bindings targeting v4.0 assemblies
    • <appSettings> entries that reference .NET 4.0 features
  • Ensure the <httpRuntime> node has no references to .NET 4.0

4. Configure the IIS Application Pool for .NET 2.0

You don’t need to upgrade IIS, but you do need to make sure your app pool runs the correct framework version:

  • Open IIS Manager and find the app pool linked to your web app
  • Right-click the app pool → Properties → .NET Framework Version
  • Select v2.0.50727 from the dropdown (avoid any v4.0.x options)
  • Recycle the app pool to apply the change

5. Check Permissions and Server Patches

  • Make sure the IIS process account (usually NETWORK SERVICE or IIS_IUSRS) has read/write permissions to your web app’s root directory and the Temporary ASP.NET Files folder mentioned earlier
  • Verify the server has the latest service pack for .NET Framework 2.0 installed—older versions often have bugs with dynamic assembly compilation

Work through these steps in order, and you should resolve the loading error without touching your IIS version.

内容的提问来源于stack exchange,提问作者user1802212

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.22 08:03:32