Web.config中运行时部分的用途

时间:2021-03-21 20:20:00

When closely observing Web.config, all the possible child elements of <configuration> are also present inside configuration/runtime.

仔细观察Web.config时, 的所有可能子元素也存在于配置/运行时中。

I have never encountered a need to specify values in configuration/runtime section. Have you come across this situation?

我从未遇到过在配置/运行时部分中指定值的需要。你遇到过这种情况吗?

What is the purpose of specifying values in runtime section ?

在运行时部分中指定值的目的是什么?

2 个解决方案

#1


3  

The purpose of <configuration><Runtime> settings as described in msdn here is

msdn中描述的 设置的目的是

"Runtime settings specify how the common language runtime handles garbage collection and the version of an assembly to use in configuration files."

“运行时设置指定公共语言运行库如何处理垃圾收集以及配置文件中要使用的程序集的版本。”

These are CLR settings that you can configure for your application. The possible settings directly under <configuration> is the not the same as <configuration><Runtime>. You can refer to the <configuration> schema here

这些是您可以为应用程序配置的CLR设置。直接在 下的可能设置与 不同。您可以在此处参考 架构

#2


1  

To add to above reply i did face real time situation to use "runtime" element for configuring Assembly binding. I was using Ninject which was referring to System.Web.MVC 3.0.0.0 while i was having System.Web.MVC with version 5.0.0.0

为了添加到上面的回复,我确实面对实时情况使用“runtime”元素来配置程序集绑定。我使用的是Ninject,它指的是System.Web.MVC 3.0.0.0,而我的System.Web.MVC版本是5.0.0.0

This was causing IOFileNotFound exception

这导致IOFileNotFound异常

By Adding "runtime" binding i could redirect any binding for System.Web.MVC to 5.0.0.0 verison.

通过添加“运行时”绑定,我可以将System.Web.MVC的任何绑定重定向到5.0.0.0版本。

#1


3  

The purpose of <configuration><Runtime> settings as described in msdn here is

msdn中描述的 设置的目的是

"Runtime settings specify how the common language runtime handles garbage collection and the version of an assembly to use in configuration files."

“运行时设置指定公共语言运行库如何处理垃圾收集以及配置文件中要使用的程序集的版本。”

These are CLR settings that you can configure for your application. The possible settings directly under <configuration> is the not the same as <configuration><Runtime>. You can refer to the <configuration> schema here

这些是您可以为应用程序配置的CLR设置。直接在 下的可能设置与 不同。您可以在此处参考 架构

#2


1  

To add to above reply i did face real time situation to use "runtime" element for configuring Assembly binding. I was using Ninject which was referring to System.Web.MVC 3.0.0.0 while i was having System.Web.MVC with version 5.0.0.0

为了添加到上面的回复,我确实面对实时情况使用“runtime”元素来配置程序集绑定。我使用的是Ninject,它指的是System.Web.MVC 3.0.0.0,而我的System.Web.MVC版本是5.0.0.0

This was causing IOFileNotFound exception

这导致IOFileNotFound异常

By Adding "runtime" binding i could redirect any binding for System.Web.MVC to 5.0.0.0 verison.

通过添加“运行时”绑定,我可以将System.Web.MVC的任何绑定重定向到5.0.0.0版本。