Getting global.asax file error when using virtual directories for MVC application

I have a running MVC 4 application deployed on an IIS server. I wanted to duplicate this MVC application on another website in IIS, so I linked the Bin, Views, Scripts and Images of the MVC working site to the new site using virtual directories. Then I copied the global.asax and web.config files to the root directory of the new site. When viewing the new content of the siteโ€™s content, it looks identical to the original layout of the siteโ€™s catalog, except that the folders are virtual.

When I launch a new site in a browser, I get the following error:

Parse Error: Parser Error Message: Could not load type 'PrApp.MvcApplication'. <%@ Application Codebehind="Global.asax.cs" Inherits="PrApp.MvcApplication" Language="C#" %> 

I read about it, but could not find anything. Most of them deal with poor assemblies or missing namespaces, but since I know what works in assemblies, I'm not sure why I get this error. My assumption is that this website will function exactly the same as the other, as the files and dll are all โ€œpresentโ€, but perhaps this is a bad assumption due to my lack of experience with the code executed.

My goal is to run the same mvc application on multiple IIS sites so that each of them can have its own root directory while I can maintain one code base.

Any help is much appreciated!

UPDATE: Image of IIS. - A dedicated site is one that has virtual directories. Another extended site is a working MVC application.

enter image description here

UPDATE 2: I deleted the global.asax file from the root of the secondary site and the error went away. NOw I get the following error: 403 - Forbidden: Access denied. I also tried to convert my virtual directories to applications, but to no avail. I am not sure if this is progress. Please let me know if you have any suggestions.

0
source share
1 answer

Ok Well, as nothing seemed to offer exactly what we wanted, we finished creating real directory structures for our hosted sites, and then created html pages in each that communicated with the application via webAPI and / or iFrames depending on , what is needed.

The only thing I could think of was to somehow somehow programmatically maintain the same code base on thousands of sites. If anyone has any other ideas, I'm all ears!

0
source

Source: https://habr.com/ru/post/890614/


All Articles