使用虚拟目录MVC应用程序时,遇到了一个Global.asax文件错误 [英] Getting a global.asax file error when using virtual directories for an MVC application

查看:979
本文介绍了使用虚拟目录MVC应用程序时,遇到了一个Global.asax文件错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经部署到IIS服务器工作的MVC应用4。我想复制此MVC应用程序在IIS中另一个网站里面,所以我联系了滨,视图,脚本,工作MVC网站的图片使用虚拟目录的新网站。然后我复制在Global.asax和Web.config文件中到新的站点的根目录。在审查新网站的内容来看,它看起来与原来的网站目录布局,除了文件夹是虚拟的。

I have a working MVC 4 application deployed to an IIS server. I wanted to duplicate this MVC app inside of another website in IIS so I linked the Bin, Views, Scripts, and Images of the working MVC site to the new site using virtual directories. I then copied the global.asax and web.config files to the root directory of the new site. When reviewing the new site's content view, it looks identical to the original's site directory layout, except that folders are virtual.

当我走在浏览器中运行新的网站,我收到以下错误:

When I go to run the 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#" %>

我读了这一点,但无法找到任何一点。大多数处理不好的组件或缺少命名空间,但因为我知道这个组件的工作,我不知道为什么我会收到此错误。我的假设是,这个网站将完全相同的功能像其他以来的文件和dll的都是present,但也许这是一个坏的假设,由于我缺乏遵守code的经验。

I've read up on this, but could not find anything on point. Most dealt with bad assemblies or missing namespaces but since I know the assemblies work I am not sure why I would be receiving this error. My assumption is that this website would function exactly like the other since the files and dll's are all "present" but perhaps this is a bad assumption due to my lack of experience with complied code.

我的目标是运行多个IIS站点在同一个MVC应用程序,使他们每个人都可以有自己的根目录下,而我可以保持一个code基地。

My goal is to run the same mvc app within multiple IIS sites so they each can have their own root directory while I can maintain a single code base.

任何帮助是极大AP preciated!

Any help is greatly appreciated!

更新:
IIS的形象。 - 突出显示的网站是一个具有虚拟目录。其他扩展网站是工作MVC应用程序。

UPDATE: Image of IIS. - Highlighted site is the one with the virtual directories. The other expanded site is the working MVC app.

更新2:
我从辅助站点的根目录中删除Global.asax文件和错误走了。现在,我收到以下错误:403 - 禁止:拒绝访问。我也曾尝试转换我的虚拟目录的应用程序,但无济于事。我不知道这是进步。请让我知道如果您有任何建议。

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

推荐答案

确定。还有什么似乎提供正是我们想要的,我们最终构建出真正的目录结构为我们的托管网站,并创造了每一个通过的WebAPI和/或根据需要什么的iFrame应用交流html页面。

Ok. Well as nothing seemed to offer exactly what we wanted, we ended up building out real directory structures for our hosted sites and then created html pages in each that communicated with the app via webAPI and/or iFrames depending on what is required.

我能想到的唯一的另一件事是莫名其妙地保持在数以千计的编程网站同code基地。如果任何人有任何其他想法,我洗耳恭听!

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

这篇关于使用虚拟目录MVC应用程序时,遇到了一个Global.asax文件错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆