2011-07-06 58 views
0

我已经在家用计算机上完成了我的网页并准备上传它。使用LINQ将数据库从SQL Server 2008 R2更改为SQL Server 2008

但是我得到这个错误:

A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)

我知道连接字符串是正确的。我运行了几个不同的页面,以便可以毫无问题地连接到其他数据库。

这是我用过LINQ的第一次,我想也许有一个设置让我需要改变? LINQ是我DAL是单独的数据库,它只是存储在我的bin文件夹中的DLL ...使用

我的开发服务器使用SQL Server 2008 R2 Express和我活的服务器使用SQL Server 2008

我创建了数据库脚本来创建数据库。所以我只是运行它们来降级网页。

也是我DAL我只是这样做:从web.config文件

AHDBcontext db = new AHDBcontext(connectionstring); 

var whatever = from s in suppliers 
       select s; 

我总是设置连接字符串。

任何想法?

+0

你**不能**降级从2008 R2到2008数据库 - 你如何在服务器上创建该数据库?从脚本? ALso:LINQ只是一种通用技术 - 你不清楚你是使用** Linq-to-SQL **还是** Linq-to-Entities **(Entity Framework)。 EF有独立的,特定的连接字符串,看起来不同于标准的ADO.NET连接字符串... –

+0

已编辑的主要问题。但是,我创建了脚本来创建数据库。 – Michael

+0

你仍然不是说它是** Linq-to-SQL **还是** Linq-to-Entities ** ......另外:你能告诉我们**连接字符串吗? –

回答

0
  1. 检查连接字符串。

另一种方式如下。

转到启动=>微软SQL Server 2008中=> Configuratiuon工具=> SQL Server配置管理

检查客户端协议的启用状态。

enter image description here

重启浏览和其他必要的服务。

enter image description here

相关问题