11

私はこれについてとても混乱しています。プロジェクトを公開するときにライブ SQL Server を開発および使用しているときに、デスクトップで SQL Server を使用したいと考えています。Visual Studio 2010 で変換を行っています。

プロジェクトをパブリッシュしようとすると、「一致ロケーターの属性 'name' が存在しません」というメッセージが表示されます。

私の Web.config ファイルには次のものが含まれています。

<connectionStrings>
    <add name="EFDbContext" connectionString="Data Source=.\SQLEXPRESS;Integrated Security=SSPI;Initial Catalog=db" providerName="System.Data.SqlClient"/>
</connectionStrings>

<system.web>
    <sessionState mode="SQLServer" sqlConnectionString="Server=.\SQLEXPRESS;Integrated Security=SSPI;Initial Catalog=ASPState;Application Name=eGov" timeout="20" allowCustomSqlDatabase="true" />
</system.web>

私はまだそれをテストしているので、今のところ、私の Web.Release.config ファイルには次のものが含まれています。

<connectionStrings>
    <add name="EFDbContext"
        connectionString="Data Source=.\SQLEXPRESS;Integrated Security=SSPI;Initial Catalog=db" 
            providerName="System.Data.SqlClient" 
            xdt:Transform="SetAttributes" xdt:Locator="Match(name)" />
</connectionStrings>

<system.web>
    <compilation xdt:Transform="RemoveAttributes(debug)" />
    <sessionState mode="SQLServer"
        sqlConnectionString="Server=.\SQLEXPRESS;Integrated Security=SSPI;Initial Catalog=ASPState;Application Name=app"
        timeout="20" allowCustomSqlDatabase="true"
        xdt:Transform="SetAttributes" xdt:Locator="Match(name)" />
</system.web>

私がオンラインで見ているものはすべて、私をさらに混乱させるだけです. 私を立ち上げて実行するための助けはありますか?

4

3 に答える 3

16

xdt:Locator="Match(name)システムが名前タグを使用して置換するノードを照合することを意味します。name属性がない場合は失敗します。このタイプの変換を使用するには、固有の属性が必要です。

于 2012-08-24T01:38:56.910 に答える
11

どっ!問題はsessionStateセクションにありました。そのはず:

<system.web>
    <sessionState mode="SQLServer"
        sqlConnectionString="Server=.\SQLEXPRESS;Integrated Security=SSPI;Initial Catalog=ASPState;Application Name=app"
        timeout="20" allowCustomSqlDatabase="true"
        xdt:Transform="SetAttributes" xdt:Locator="XPath(configuration/system.web/sessionState)" />
</system.web>
于 2011-11-03T16:36:49.343 に答える
5

Match(name) で「name」を使用するのは、次のような一般的な構成設定です。この場合のキーは「名前」です。

<add name="errorAddress" email="me@google.com" xdt:Transform="SetAttributes" xdt:Locator="Match(name)" />

設定のキーが他のものである場合は、それを使用する必要があります。

<add token="UserToken" value="23jkl2klk2j3kja9d8f" xdt:Transform="SetAttributes" xdt:Locator="Match(token)"/>
于 2016-08-03T22:08:25.787 に答える