我使用ASP.NET和Entity Framework C#在網上購物Web應用程序的工作。問題是,我的應用程序運行正常,當我測試了我的本地ASP.NET開發服務器上,但是當我主辦的網站,它提供了以下錯誤:應用程序中的服務器錯誤。無效的對象名稱dbo.Categories「
Server Error in '/samarth' Application. Invalid object name 'dbo.Categories'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Data.SqlClient.SqlException: Invalid object name 'dbo.Categories'.
有什麼不對的連接字符串?
<connectionStrings>
<add name="ApplicationServices" connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\aspnetdb.mdf;User Instance=true" providerName="System.Data.SqlClient"/>
<add name="CommerceEntities" connectionString="metadata=res://*/Data_Access.EDM_Commerce.csdl|res://*/Data_Access.EDM_Commerce.ssdl|res://*/Data_Access.EDM_Commerce.msl;provider=System.Data.SqlClient;provider connection string="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\Commerce.mdf;Integrated Security=True;User Instance=True;MultipleActiveResultSets=True"" providerName="System.Data.EntityClient"/>
</connectionStrings>
得到這個錯誤:
The specified named connection is either not found in the configuration, not intended to be used with the EntityClient provider, or not valid.
你問「連接字符串是否有問題? - 但你沒有顯示它! –
查看[this](http://aspspider.info/samarth/)進行演示。 –
這是一個非常明確的錯誤:「無效的對象名'dbo.Categories'。」您的權限錯誤,您指向錯誤的數據庫,並且您沒有正確部署目標數據庫。修理它。 –