1
我在IIS 7.5上部署Web應用程序,該Web應用程序有三種供用戶選擇的自行車(山地自行車,公路自行車和旅行自行車) 。當我點擊每一個就可以了,我有一個問題System.Data.SqlClient.SqlException:用戶XXX登錄失敗
System.Data.SqlClient.SqlException:用戶登錄失敗XXX
這裏是我的連接字符串:
<connectionStrings>
<add name="DefaultConnection" providerName="System.Data.SqlClient" connectionString="Data Source=.\SQLEXPRESS;Initial Catalog=aspnet-AdventureCycle-20140110145435;Integrated Security=SSPI" />
<add name="AdvenBikesEntities" connectionString="metadata=res://*/Models.BikesDB.csdl|res://*/Models.BikesDB.ssdl|res://*/Models.BikesDB.msl;provider=System.Data.SqlClient;provider connection string="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\AdventureWorks2012_Data.mdf;Integrated Security=True;MultipleActiveResultSets=True;Application Name=EntityFramework;User Instance=True"" providerName="System.Data.EntityClient" />
<add name="AdventureBikesDataEntities" connectionString="metadata=res://*/Models.CategoriesBikesDB.csdl|res://*/Models.CategoriesBikesDB.ssdl|res://*/Models.CategoriesBikesDB.msl;provider=System.Data.SqlClient;provider connection string="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\AdventureWorks2012_Data.mdf;Integrated Security=True;MultipleActiveResultSets=True;Application Name=EntityFramework;User Instance=True"" providerName="System.Data.EntityClient" />
<add name="AdventureBikeDataEntities" connectionString="metadata=res://*/Models.AdventureBikeDB.csdl|res://*/Models.AdventureBikeDB.ssdl|res://*/Models.AdventureBikeDB.msl;provider=System.Data.SqlClient;provider connection string="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\AdventureWorks2012_Data.mdf;Integrated Security=True;MultipleActiveResultSets=True;Application Name=EntityFramework;User Instance=True"" providerName="System.Data.EntityClient" />
<add name="AdventureBikesDBEntities" connectionString="metadata=res://*/Models.AdventureBikesEntities.csdl|res://*/Models.AdventureBikesEntities.ssdl|res://*/Models.AdventureBikesEntities.msl;provider=System.Data.SqlClient;provider connection string="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\AdventureWorks2012_Data.mdf;Integrated Security=True;MultipleActiveResultSets=True;Application Name=EntityFramework;User Instance=True"" providerName="System.Data.EntityClient" />
<add name="AdventureBikeDBEntities" connectionString="metadata=res://*/Models.AdventureBikeDB.csdl|res://*/Models.AdventureBikeDB.ssdl|res://*/Models.AdventureBikeDB.msl;provider=System.Data.SqlClient;provider connection string="data source=TRUNGGEORGE-PC\MSSQLSERVER2012;initial catalog=AdventureWorks2012;Integrated Security=True;User ID=trung;Password=tuoi312;MultipleActiveResultSets=True;App=EntityFramework"" providerName="System.Data.EntityClient" /></connectionStrings>
你能幫我解決這個問題嗎?非常感謝你的時間:)
「Integrated Security = SSPI」表示使用Windows用戶的憑據。但是,如果你正在做一個網站,IIS的配置可以改變它實際上是使用鼠標的用戶還是運行IIS的系統用戶。許多網站爲應用程序創建一個特定的用戶,並在連接字符串中指定該用戶。這個參考網站很有用 - ish:http://www.connectionstrings.com – GregHNZ