Server Error in Application. Invalid object name 'dbo.Categories' c#-4.0 entity-framework visual-studio-2010


Using ASP.NET and Entity Framework in C#, I'm developing a web application for online shopping. When I test my application on my local ASP.NET Development Server, there is no issue, but when I host the website, it provides the following error:

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

Is the connection string flawed in any way?

        <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=&quot;Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\Commerce.mdf;Integrated Security=True;User Instance=True;MultipleActiveResultSets=True&quot;" providerName="System.Data.EntityClient"/>

Got this mistake:

The specified named connection is either not found in the configuration, not intended to be used with the EntityClient provider, or not valid.

12/11/2012 1:24:30 PM

Accepted Answer

You're receivingSystem.Data.SqlClient.SqlException It indicates that you are connecting to the database because the database gave this exception, so most likely your database is not up to date on the server. Check to see whether youdbo.Categories exists On the database, you are logging in. Read more information about the connection string here.

12/11/2012 2:57:47 PM

Related Questions


Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow