ASP.NET Web Application "Failed to load assembly" App_Web_ "
I am trying to deploy my first ASP.NET web application.
So far, I've gone to Build> Publish Website> Publish to Filesystem and created my web app by packaging .cs files to bin directory in multiple DLLs. Then I copied this output to my web server
When developing on my local machine everything was in the same directory, on the webserver my web application is in the root / myApplication subdirectory.
My web.config in the root directory looks like this:
<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>
Whenever I access any .aspx page from my application on the web server, I get the following error.
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" %>
I've seen a number of other similar questions, but none had a clear solution. I noticed in the bin folder created by publishing the site through visual studio, there are two "Compiled files". virtual file paths are mentioned inside these files. This file path matches the name and folder of my solution from a visual studio project, but not the web server directories. Is this also a problem?
<preserve resultType="6" virtualPath="/WebTest/App_Code/" hash="2c00728f" filehash="" flags="140000" assembly="App_Code" />
source to share
I found a solution to my problem, so I'll post my solution so that it will hopefully help others.
The solution for me was to move the bin folder from my subdirectory (containing my application) to the root directory of my site.
If your app is not in the root directory, try this fix.
source to share