有没有一种方法可以从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 theASP.NET Core Modul
e and moved to published output. The transformation doesn't modify IIS configuration settings in the file.The
web.config
file may provide additionalIIS
configuration settings that control activeIIS
modules. For information onIIS
modules that are capable of processing requests withASP.NET Core
apps, see theIIS
modules topic.To prevent the Web SDK from transforming the web.config file, use the
IsTransformWebConfigDisabled
property in the project file.