无法连接到SQL Server 2008中的.Net [英] Unable to connect to SQL Server 2008 in .Net

查看:261
本文介绍了无法连接到SQL Server 2008中的.Net的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我工作的一个C#Web服务。

我已经部署的Web服务,这是工作完全在我的本地系统,但是当我尝试到我的虚拟专用服务器上运行同样的服务它返回一个错误。

这是我的连接字符串

 数据源=< serverinstance> \\ SQLEX $ P $干燥综合征;初始目录= DomainTable;用户ID =< serverinstance> \\管理;密码=< Windows_Login_Password>
 

在此我使用这个连接字符串

 数据源=< serverinstance> \\ SQLEX $ P $干燥综合征;初始目录= DomainTable;集成安全性= SSPI;
 

他们没有为我工作。请帮助它真的很重要

解决方案
  

数据源= serverinstance \ SQLEX $ P $干燥综合征;
  ----------------------------------------- ^这里只有一个斜杠

另外,还要确保远程服务器可以看到任何你所引用为< serverinstance> 。你可能有这样的本地主机但你的Web服务器不考虑你的机器是localhost。它也可能不能够通过名称到达它,特别是如果它是在一个不同的域

如果您尝试使用Windows身份验证,有地球上没有办法,你应该使用:

  

用户ID = serverinstance \管理;密码= Windows_Login_Password

哇,永远硬codeA的Windows密码的任何地方。如果要使用SQL身份验证,然后设置。否则,你应该使用,而不是这个用户名/密码:

  

持续安全信息= TRUE;

和确保IIS用户已被授予访问您的SQL Server。

I am working on a C# web service.

I have deployed a web service which is working perfectly on my local system but when I try to run the same service on my virtual dedicated server it is returning an error.

This is my connection string

Data Source = <serverinstance>\\SQLEXPRESS; Initial Catalog = DomainTable; User ID= <serverinstance>\\admin; Password = <Windows_Login_Password>

Before this I was using this connection string

Data Source=<serverinstance>\\SQLEXPRESS; Initial Catalog=DomainTable; Integrated Security=SSPI";

None of them is working for me. please help its really really important

解决方案

Data Source=serverinstance\SQLEXPRESS;
-----------------------------------------^ only one slash here

Also make sure that the remote server can see whatever you've referenced as <serverinstance>. You may have this as localhost but your web server does not consider your machine to be localhost. It may also not be able to reach it by name, particularly if it is in a different domain.

If you are trying to use Windows Authentication, there is no way on earth you should be using:

User ID = serverinstance\admin; Password = Windows_Login_Password

Wow, never hard-code a Windows password anywhere. If you want to use SQL authentication, then set up . Otherwise you should be using this instead of User ID / Password:

Persist Security Info = true;

And ensuring that the IIS user has been granted access to your SQL Server.

这篇关于无法连接到SQL Server 2008中的.Net的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆