2011-11-03 4 views
6

Tôi rất bối rối về điều này. Tôi muốn sử dụng SQL Server trên máy tính để bàn của mình khi tôi đang phát triển và sử dụng SQL Server trực tiếp khi tôi xuất bản dự án của mình. Tôi đang chơi với các công cụ chuyển đổi trong Visual Studio 2010.Tại sao tôi nhận được lỗi "Tên thuộc tính" tồn tại cho lỗi Công cụ tìm kiếm đối sánh "khi xuất bản?

Tôi nhận được tên "Không có thuộc tính" tồn tại cho Công cụ định vị đối sánh "khi tôi cố gắng xuất bản dự án của mình.

file Web.config của tôi chứa:

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

tôi vẫn đang thử nghiệm nó, vì vậy bây giờ, tập tin Web.Release.config tôi bao gồm:

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

Bất cứ điều gì tôi nhìn thấy trực tuyến là chỉ làm tôi bối rối hơn. Bất kỳ trợ giúp nào để giúp tôi và chạy?

Trả lời

5

Doh! Sự cố nằm trong phần sessionState. Nó nên là:

<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) nghĩa là hệ thống mà sẽ phù hợp với các nút để thay thế sử dụng tên thẻ. Nếu bạn không có thuộc tính tên thì nó không thành công. Bạn phải có một số thuộc tính duy nhất để sử dụng loại chuyển đổi này.

2

Sử dụng "tên" trong Kết hợp (tên) là dành cho cài đặt cấu hình điển hình như sau. Chìa khóa trong trường hợp này là "tên".

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

Nếu chủ chốt trong thiết lập của bạn là cái gì khác, đó là những gì bạn cần sử dụng:

<add token="UserToken" value="23jkl2klk2j3kja9d8f" xdt:Transform="SetAttributes" xdt:Locator="Match(token)"/>