有没有一种方法可以从C#中设置requestTimeout,而不需要在requestTimeout中设置web.config

IIS中托管的asp.net core 2.0

<?xml version="1.0" encoding="utf-8"?> 
<configuration> 
  <system.webServer> 
    <handlers> 
      <add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" /> 
    </handlers> 
    <aspNetCore requestTimeout="00:00:04" processPath="dotnet" arguments=".\Foo.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" /> 
  </system.webServer> 
</configuration> 

Not like this

请您参考如下方法:

否,无法按照您的描述进行操作。但是根据documentation ,您可以将web.config添加到项目中,并指定此(和其他)设置值:

If a web.config file isn't present in the project, the file is created with the correct processPath and arguments to configure the ASP.NET Core Module and moved to published output.

If a web.config file is present in the project, the file is transformed with the correct processPath and arguments to configure the ASP.NET Core Module and moved to published output. The transformation doesn't modify IIS configuration settings in the file.

The web.config file may provide additional IIS configuration settings that control active IIS modules. For information on IIS modules that are capable of processing requests with ASP.NET Core apps, see the IIS modules topic.

To prevent the Web SDK from transforming the web.config file, use the IsTransformWebConfigDisabled property in the project file.


评论关闭
IT干货网

微信公众号号:IT虾米 (左侧二维码扫一扫)欢迎添加!