【发布时间】:2012-12-11 05:59:09
【问题描述】:
我正在使用 ASP.NET 和实体框架 c# 开发在线购物 Web 应用程序。问题是当我在本地 ASP.NET 开发服务器上测试我的应用程序时,它运行良好,但是当我托管网站时,它给出了以下错误:
“/samarth”应用程序中的服务器错误。 无效的对象名称“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>
得到这个错误:
在配置中找不到指定的命名连接,不打算与 EntityClient 提供程序一起使用,或者无效。
【问题讨论】:
-
您问“连接字符串有问题吗?” - 但你还没有展示出来!
-
查看this 以获得演示。
-
这是一个非常明确的错误:“无效的对象名称'dbo.Categories'。”您的权限错误,您指向错误的数据库,并且您没有正确部署目标数据库。修复它。
-
我想我在处理连接字符串时遇到了麻烦。
-
-1 投票不能解决我的问题,甚至没有帮助。我也反对您为帮助和理解问题所做的努力。
标签: asp.net visual-studio-2010 entity-framework c#-4.0