ASP.Net项目的配置值

时间:2013-11-21 21:06:15

标签: asp.net

我被分配到一个新的ASP.Net MVC 4.0项目中。传统上,当测试团队提出新的新问题时(例如,全球化,maxQueryStringLength,machineKey),我们习惯于添加配置值。对于这个项目,我打算采用一种新的路径..所有常用的配置值,我打算预先添加...我创建了以下配置值..还有哪些是最常用的\常用配置值在ASP.Net项目中?

的System.Web

<system.web>

    <!--Culture-->
    <globalization culture="en-US" uiCulture="en" />

    <!--Remove Custom Errors Mode in Production-->
    <customErrors mode="Off"/>

    <!--Impersonate-->
    <identity impersonate="true"/>

    <!--Session Mode and Timeout-->
    <sessionState mode="InProc" timeout="60" />

    <!--maxQueryStringLength-->
    <httpRuntime maxQueryStringLength="6000" />

    <!--machineKey-->
    <machineKey/>

    <!--authentication-->
    <authentication mode="Windows">
    </authentication>

    <!--authorization-->
    <authorization>
      <allow users="?" />
    </authorization>

  </system.web>

system.webServer

 <system.webServer>

    <security>

      <requestFiltering>
        <!--maxQueryString-->
        <requestLimits maxQueryString="6000" />
      </requestFiltering>

      <!--IIS Setting for Authentication-->
      <authentication>
        <anonymousAuthentication enabled="false" />
        <windowsAuthentication>
          <providers>
            <clear />
            <add value="NTLM" />
          </providers>
        </windowsAuthentication>
      </authentication>

    </security>

  </system.webServer>

1 个答案:

答案 0 :(得分:1)

将连接字符串添加到web.config也是一种很好的做法。不确定是否需要访问此项目中的数据,但如果这样做,则还需要将以下内容添加到web.config文件中。

<connectionStrings>
<add name="myConnectionString" connectionString="server=localhost;Database=myDb;uid=myUser;password=myPass;" />
</connectionStrings>