C# Could not load file or assembly 'App_Web_xxxx' 的問題解決方案

<compilation> 元素
配置 ASP.NET 使用的所有编译设置。

配置结构的示例:

<configuration>
   <system.web>
      <compilation>

<compilation debug="true|false"
             batch="true|false"
             batchTimeout="number of seconds"
             defaultLanguage="language"
             explicit="true|false"
             maxBatchSize="maximim number of pages per
                           batched compilation"
             maxBatchGeneratedFileSize="maximum combined size (in KB)
                                        of the generated source file per
                                        batched compilation"
             numRecompilesBeforeAppRestart="number"
             strict="true|false"
             tempDirectory="directory under which the ASP.NET temporary
                            files are created">
   <compilers>
      <compiler language="language"
                extension="ext"
                type=".NET Type"
                warningLevel="number"
                compilerOptions="options"/>
   </compilers>
   <assemblies>
      <add assembly="assembly"/>
      <remove assembly="assembly"/>
      <clear/>
   </assemblies>
</compilation>
可选的属性
属性 选项 描述
debug     指定是编译二进制发布文件还是编译二进制调试文件。默认值为 false。
    true 指定编译二进制调试文件。
    false 指定编译二进制发布文件。
defaultLanguage     指定在动态编译文件中使用的默认编程语言(例如“C#”或“PERL”)。使用 <compiler> 子标记来定义语言名称。默认设置为 vb。
explicit     表示 Microsoft Visual Basic explicit 编译选项的设置。默认值为 true。
    true 表示启用了 Visual Basic explicit 编译选项,并且必须使用 Dim、Private、Public 或 ReDim 语句来声明所有变量。
    false 表示禁用 Visual Basic explicit 编译选项。
batch     表示是否支持批处理。
    true 表示支持批处理。
    false 表示不支持批处理。
batchTimeout     表示用于批处理编译的超时周期(以秒为单位)。如果编译在超时周期内不能结束,则编译器将为当前页还原为单独编译模式。
maxBatchGeneratedFileSize     指定每个批处理编译所生成的源文件的最大大小(以 KB 为单位)。
maxBatchFileSize     指定每次批处理编译的页面的最大数量。
numRecompilesBeforeApprestart     表示在应用程序重新启动前,资源的动态重新编译可发生的次数。该属性在全局和应用程序级别受支持,但在目录级别不受支持。
strict     表示 Visual Basic strict 编译选项的设置。
    true 表示 Visual Basic strict 编译选项已启用。
    false 表示禁用 Visual Basic strict 编译选项。
tempDirectory     指定编译期间用于存储临时文件的目录。

子标记
子标记 描述
<compilers> 定义新的编译器选项。
<assemblies> 指定 ASP.NET 编译处理指令。

示例
下例为应用程序配置编译设置。

<configuration>
   <system.web>
      <compilation defaultLanguage="VB"
         debug="true"
         numRecompilesBeforeAppRestart="15">
         <compilers>
            <compiler language="VB;VBScript"
               extension=".cls"
               type="Microsoft.VisualBasic.VBCodeProvider,system,    
                     Version=1.0.5000.0, Culture=neutral,
                     PublicKeyToken=b77a5c561934e089"/>
            <compiler language="C#;Csharp"
               extension=".cs"
               type="Microsoft.CSharp.CSharpCodeProvider,system,
                     Version=1.0.5000.0,  Culture=neutral,
                     PublicKeyToken=b77a5c561934e089"/>
         </compilers>
         <assemblies>
            <add assembly="ADODB"/>
            <add assembly="*"/>
         </assemblies>
      </compilation>
   </system.web>
</configuration>
要求
包含在:<system.web> 中
Web 平台:IIS 5.0、IIS 5.1、IIS 6.0
配置文件:Machine.config、Web.config
配置节处理程序:System.Web.Configuration.CompilationConfigHandler

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值