简体   繁体   English

配置一个asp.net项目

[英]Configuring an asp.net project

If I want to add this lines for configuring an asp.net MVC4 app, 如果要添加此行以配置asp.net MVC4应用,

<configuration>  
<startup useLegacyV2RuntimeActivationPolicy="true"><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup>  
</configuration>  

in which file should I put them? 我应该把它们放在哪个文件中? Should I create an app.config file or put them in the web.config file? 我应该创建一个app.config文件还是将它们放在web.config文件中? I used to add them for a console app or class library app.config and I got what I need, but now I have an asp.net mvc4 project. 我曾经将它们添加到控制台应用程序或类库app.config中,我得到了所需的东西,但是现在有了asp.net mvc4项目。

You can put it in app.config file. 您可以将其放在app.config文件中。

But here is what you should know. 但是,这是您应该知道的。

Web.config is for ASP.NET and ASP.NET MVC; Web.config用于ASP.NET和ASP.NET MVC; app.config is for desktop applications and DLLs. app.config用于桌面应用程序和DLL。

If you need to store any kind of parameter for your application that you can change without having to recompile, Web.config is the place to go. 如果您需要为应用程序存储任何类型的参数,而无需重新编译就可以更改它们,那么Web.config是一个理想的选择。

Cheer! 欢呼!

将其添加到根目录中的web.config文件中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM