ASP.NET编译网站报错:未能加载类型.Global.asax,把CodeBehind改为CodeFile即可


解决方案:
把CodeBehind改为CodeFile即可,参考以下的代码,编译成功!
C# Code:
<%@ Application CodeFile ="Global.asax.cs" Inherits ="AliAdminTool.WebApi.ServerIISHosting.Global" Language="C#" %>
//来源:C/S框架网 | www.csframework.com | QQ:23404761
//来源:C/S框架网 | www.csframework.com | QQ:23404761
PS: CodeFile与CodeBehind的区别
CodeBehind
指定包含与页关联的类的已编译文件的名称。该属性不能在运行时使用。
Specifies the name of the compiled file that contains the class associated with the control. This attribute is not used at run time.
指定包含与页关联的类的已编译文件的名称,编译完后所有cs中的代码打包进dll.该属性不能在运行时使用.提供此属性是为了与以前版本的 ASP.NET 的兼容,以实现代码隐藏功能。
CodeFile
指定指向页引用的代码隐藏文件的路径。此属性与 Inherits 属性一起使用可以将代码隐藏源文件与网页相关联。此属性仅对编译的页有效。比如VS2005中新建一个网站你会发现编译比WEB应用程序慢很多,但是可以修改代码后不用整体编译刷新页面就可以看到效果.
Specifies a path to the referenced code-behind file for the control. This attribute is used together with the Inherits attribute to associate a code-behind source file with a user control. The attribute is valid only for compiled controls.

扫一扫加微信


版权声明:本文为开发框架文库发布内容,转载请附上原文出处连接
NewDoc C/S框架网