Server Error in Application. Invalid object name 'dbo.Categories'

asp.net c#-4.0 entity-framework visual-studio-2010

Question

I am working on a Online Shopping Web Apps using ASP.NET and Entity Framework c#. The problem is that my application runs fine when I test it on my local ASP.NET Development Server, but when I host the website, it gives 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 there something wrong with the connection string?

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

Got this error:

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

1
1
12/11/2012 1:24:30 PM

Accepted Answer

You are getting System.Data.SqlClient.SqlException which mean you making connection to database as this exception is returned by databse, most probably your do not have updated database on server. Check if you have dbo.Categories exists on database you are connecting. You can read more about connection string here

2
12/11/2012 2:57:47 PM


Related Questions





Related

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