ASP.NET Web 应用程序'无法加载程序集'App_Web_'
ASP.NET web application 'Could not load the assembly 'App_Web_'
我正在尝试部署我的第一个 ASP.NET 网络应用程序。
到目前为止,我已经转到“构建”>“发布网站”>“发布到文件系统”,它已经创建了我的 Web 应用程序,将 .cs 文件打包到多个 .dll 的 bin 目录中。然后我将此输出复制到我的网络服务器
在我的本地机器上开发时,所有东西都在同一个目录中,在网络服务器上,我的网络应用程序在一个子目录中,所以 root/myApplication.
我的 web.config 在根目录下是这样的:
<system.web>
<customErrors mode="Off"/>
<compilation batch="false" targetFramework="4.5" />
<httpRuntime targetFramework="4.5" />
<roleManager enabled="false" defaultProvider="MyRoles">
<providers>
<clear />
<add name="MyRoles"
type="MtManagementRoles"
connectionStringName="ControlConnection"
applicationName="/myApplication"/>
</providers>
</roleManager>
<authentication mode="Forms">
<forms loginUrl="myApplication/login.aspx" defaultUrl="myApplication/Home.aspx" name="ControlAuthentication" timeout="30" />
</authentication>
</system.web>
每当我从 Web 服务器上的应用程序访问任何 .aspx 页面时,我都会收到以下错误。
Could not load the assembly 'App_Web_15jywomu'. Make sure that it is compiled before accessing the page.
<%@ page language="C#" autoeventwireup="true" inherits="Home, App_Web_15jywomu" %>
我已经看到许多其他类似的问题,但 none 有一个明确的解决方案。我注意到在通过visual studio发布站点创建的bin文件夹中,有两个'Compiled files'。在这些文件中,它提到了虚拟文件路径。此文件路径与 visual studio 项目中我的解决方案名称和文件夹匹配,但与 Web 服务器目录不匹配。这也是一个问题吗?
<preserve resultType="6" virtualPath="/WebTest/App_Code/" hash="2c00728f" filehash="" flags="140000" assembly="App_Code" />
我找到了解决我自己问题的方法,所以我将 post 我的解决方案,希望它能帮助其他人。
我的解决方案是将 bin 文件夹从我的子目录(包含我的应用程序)移动到我网站的根目录中。
如果您的应用程序不在您的根目录中,请尝试此修复。
我解决此问题的方法是清除 "Precompile during Publishing" (Publish/Settings)
处的复选框
我正在尝试部署我的第一个 ASP.NET 网络应用程序。
到目前为止,我已经转到“构建”>“发布网站”>“发布到文件系统”,它已经创建了我的 Web 应用程序,将 .cs 文件打包到多个 .dll 的 bin 目录中。然后我将此输出复制到我的网络服务器
在我的本地机器上开发时,所有东西都在同一个目录中,在网络服务器上,我的网络应用程序在一个子目录中,所以 root/myApplication.
我的 web.config 在根目录下是这样的:
<system.web>
<customErrors mode="Off"/>
<compilation batch="false" targetFramework="4.5" />
<httpRuntime targetFramework="4.5" />
<roleManager enabled="false" defaultProvider="MyRoles">
<providers>
<clear />
<add name="MyRoles"
type="MtManagementRoles"
connectionStringName="ControlConnection"
applicationName="/myApplication"/>
</providers>
</roleManager>
<authentication mode="Forms">
<forms loginUrl="myApplication/login.aspx" defaultUrl="myApplication/Home.aspx" name="ControlAuthentication" timeout="30" />
</authentication>
</system.web>
每当我从 Web 服务器上的应用程序访问任何 .aspx 页面时,我都会收到以下错误。
Could not load the assembly 'App_Web_15jywomu'. Make sure that it is compiled before accessing the page.
<%@ page language="C#" autoeventwireup="true" inherits="Home, App_Web_15jywomu" %>
我已经看到许多其他类似的问题,但 none 有一个明确的解决方案。我注意到在通过visual studio发布站点创建的bin文件夹中,有两个'Compiled files'。在这些文件中,它提到了虚拟文件路径。此文件路径与 visual studio 项目中我的解决方案名称和文件夹匹配,但与 Web 服务器目录不匹配。这也是一个问题吗?
<preserve resultType="6" virtualPath="/WebTest/App_Code/" hash="2c00728f" filehash="" flags="140000" assembly="App_Code" />
我找到了解决我自己问题的方法,所以我将 post 我的解决方案,希望它能帮助其他人。
我的解决方案是将 bin 文件夹从我的子目录(包含我的应用程序)移动到我网站的根目录中。
如果您的应用程序不在您的根目录中,请尝试此修复。
我解决此问题的方法是清除 "Precompile during Publishing" (Publish/Settings)
处的复选框