我使用基本身份驗證我的Web API和正在以下錯誤錯誤的connectionStringName屬性不允許
* {「消息」,「ExceptionMessage」:「網絡(SQL Server)連接到服務器時發生錯誤或特定於實例的錯誤未找到服務器或無法訪問服務器驗證實例名稱是否正確以及SQL Server是否配置爲允許遠程連接(提供程序:命名管道提供程序,錯誤:40 - 無法打開連接到SQL *
它工作絕對沒問題,當我從我的API中刪除基本的身份驗證實施,所以我猜測問題應該是與system.w相關的東西eb.providers用於基本身份驗證實現。
這是我的連接字符串看起來像
<connectionStrings>
<add name="DefaultConnection" connectionString="Password=password;Persist Security Info=True;User ID=wbuser;Initial Catalog=WinBouts_com;Data Source=WINBOUTSAPIVM"
providerName="System.Data.SqlClient" />
<add name="WinBoutsConnectionString" connectionString="Password=password;Persist Security Info=True;User ID=wbuser;Initial Catalog=WinBouts_com;Data Source=WINBOUTSAPIVM"
providerName="System.Data.SqlClient" />
,我看到在我的web.config的錯誤,其中添加了會話提供。錯誤說「不允許connectionStringName屬性」。但是,如果我刪除它然後它要求connectionStringName。這是它的代碼。
<!--
If you are deploying to a cloud environment that has multiple web server instances,
you should change session state mode from "InProc" to "Custom". In addition,
change the connection string named "DefaultConnection" to connect to an instance
of SQL Server (including SQL Azure and SQL Compact) instead of to SQL Server Express.
-->
<sessionState mode="Custom" customProvider="DefaultSessionProvider">
<providers>
<add name="DefaultSessionProvider" type="System.Web.Providers.DefaultSessionStateProvider, System.Web.Providers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" connectionStringName="WinBoutsConnectionString" />
</providers>
</sessionState>
任何人都可以請告訴我我哪裏可能會出錯嗎?任何建議或意見將深受讚賞。
您正在使用什麼版本的.NET和該網站配置了什麼版本? – Oded
他們都是相同的4.0版本!如果他們不同,那麼當我刪除基本身份驗證實現時,該網站不會工作!任何其他想法? – Bitsian