为什么在我的MVC适用的两个web.config文件中 [英] Why are there two web.config files in my MVC application
问题描述
有一个在浏览文件夹中。
There is one in the Views folder.
和有另一种在应用程序的根目录。
And there is another in the root of the app.
我要注册自定义的处理器,我不能明白的地方的code应该去。
我跑IIS7集成模式,所以我必须添加一个<处理>
标签< system.webServer>
,但是当我在看的浏览文件夹中的web.config我看到它使用了< HttpHandlers的>在
标签&LT
;的System.Web方式>
I want to register a custom handler and i cant understand where the code should go.
I'm running IIS7 in Integrated Mode so I have to add a <handlers>
tag to the <system.webServer>
but when I'm looking at the web.config at the Views folder I see that it uses a <httpHandlers>
under <system.web>
tag.
于是两个问题:
1.为什么在一个MVC适用的两个web.config文件中?
2.在何处及以何种方式我要注册我的自定义HTTP处理程序?
So two questions: 1. why are there two web.config files in an mvc application? 2. where and in what way I should register my custom HTTP Handler?
推荐答案
您应该根的配置注册。查看配置是配置视图,例如:添加命名空间各方意见,等等。
You should register it in root config. Views config is for configure views, for example: add namespace for all views and etc.
- ASP.NET MVC and two Web.config files
- why are there 2 web.config files
这篇关于为什么在我的MVC适用的两个web.config文件中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!