2011-11-03 3 views
6

私はこれにとても混乱しています。私は自分のデスクトップをSQL Serverで使用したいのですが、私は自分のプロジェクトを公開するときにライブSQL Serverを開発して使用しています。私はVisual Studio 2010で変換のものを試しています。公開時に「一致するロケータ」の「属性がありません」というエラーが表示されるのはなぜですか?

プロジェクトを公開しようとすると、「一致ロケータの属性がありません」という名前が表示されます。

私の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> 

ものはありますただもっと混乱させるだけだ。私を立ち上げて走らせる助けがありますか?

答えて

5

Doh!問題は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> 
11

xdt:Locator="Match(name)名前タグを使用して交換するノードに一致するようシステムを意味します。 の名前がの場合、それは失敗します。このタイプの変換を使用するには、独自の属性が必要です。

2

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

<add name="errorAddress" email="[email protected]" xdt:Transform="SetAttributes" xdt:Locator="Match(name)" /> 

あなたの設定でキーが何か他のものであれば、それはあなたが使用するために必要なものです:

<add token="UserToken" value="23jkl2klk2j3kja9d8f" xdt:Transform="SetAttributes" xdt:Locator="Match(token)"/> 
関連する問題