SQL异常:管道的另一端没有进程 [英] Sql Exception: No Process Is on the Other End of the Pipe
问题描述
我无法从C#代码访问我的SQL Server连接.我收到此错误:
I can not access my sql server connection from c# code. I get this error:
Sql异常:管道的另一端没有进程
Sql Exception: No Process Is on the Other End of the Pipe
那是我的app.config中的连接字符串:
thats the connection string in my app.config:
<add name="DefaultConnection" providerName="System.Data.SqlClient" connectionString="Data Source=BELLA\SQLEXPRESS;Initial Catalog=TLP;User Id=pascal;Password=test;Pooling=False"/>
当我使用Windows身份验证时:Integrated Security = True;
When I use windows authentication: Integrated Security=True;
然后我可以连接到数据库.
Then I can connect to the database.
但是我不能使用Windows身份验证,因为sql连接的打开是从作为LocalSystem运行的Windows服务中完成的.当我这样做时,我会收到此错误:
BUT I can NOT use windows authentication because the opening of the sql connection is done from within a windows service which is run as LocalSystem. When I do this I get this error:
登录失败.用户'NT AUTHORITY \ SYSTEM'登录失败
这是我第一次在sql Management Studio中创建登录名+用户,因此几乎可以确定我做错了事,这是我的错.
Its the first time I create a login + user in sql management studio so I am nearly sure I did something wrong and its my fault.
这就是我所做的:
1)使用sql身份验证用户:pascal和密码:test在服务器的安全文件夹中创建新的登录名.
1) Create a new login in the server`s security folder with sql authentication user:pascal and password:test.
2)进入我的数据库,并在安全文件夹中使用以下用户创建一个新用户:pascal和登录名:pascal和架构:dbo
2) Went to my database and create a new user in the security folder with user: pascal and login: pascal and schema: dbo
3)我忘记了什么吗?
3) Did I forget something?
其他人的解决方案:
1)我也尝试了此链接,但不走运,我的可疑页面页上的Sql Select是空的.
1) I have also tried this link but no luck my Sql Select on the suspect_pages table is empty.
2)我的Sql Server网络配置在tcp/ip上已启用,命名管道和共享内存设置.
2) My Sql Server network configuration has ENABLED on the tcp/ip, names pipes and shared memory settings.
数字1到3根本没有帮助.
Number 1 to 3 did not help at all.
所有这些都在我的本地计算机上完成.这里没有网络.
All this is done on my local machine. No network is here.
推荐答案
您是否在SQL配置中启用了共享内存和TCP/IP提供程序?
Did you enable Shared Memory and TCP/IP providers in SQL configuration?
如果没有,请尝试打开SQL Server配置管理器实用程序并启用共享内存和TCP/IP.适用于我的顺序是服务器和客户端的共享内存(1)和TCP/IP(2).
If not, try opening the SQL Server Configuration Manager utility and enabling Shared Memory and TCP/IP. The order that works for me is Shared Memory (1) and TCP/IP (2) for both server and client.
此外,请确保同时为具有正确权限的PASCAL创建SQL LOGIN和DATABASE USER.
Also, make sure you are creating both a SQL LOGIN and DATABASE USER for PASCAL with correct rights.
查看我有关创建登录名的博客文章. http://craftydba.com/?p=656
Check out my blog article on creating logins. http://craftydba.com/?p=656
下面的代码片段将消失,并使用正确的默认数据库,默认架构和读/写权限重新创建您的登录名/用户.
The snippet below will blow away and recreate your login/user with the correct default database, default schema and read/write privileges.
-- Which database to use.
USE [TLP]
GO
-- Delete existing user.
IF EXISTS (SELECT * FROM sys.database_principals WHERE name = N'pascal')
DROP USER [pascal]
GO
-- Which database to use.
USE [master]
GO
-- Delete existing login.
IF EXISTS (SELECT * FROM sys.server_principals WHERE name = N'pascal')
DROP LOGIN [pascal]
GO
-- Add new login.
CREATE LOGIN [pascal] WITH PASSWORD=N'test', DEFAULT_DATABASE=[TLP]
GO
-- Which database to use.
USE [TLP]
GO
-- Add new user.
CREATE USER [pascal] FOR LOGIN [pascal] WITH DEFAULT_SCHEMA=[dbo]
GO
-- Add to database read / write roles
EXEC sp_addrolemember 'db_datareader', 'pascal'
EXEC sp_addrolemember 'db_datawriter', 'pascal'
GO
-- Add to database owner role?
-- Only give out if application needs a high level of privileges.
-- EXEC sp_addrolemember 'db_owner', 'pascal'
-- GO
服务器级协议.
客户端级别协议.
我从不选择NETBIOS,因为它是不可路由的协议.
I never choose NETBIOS since it is a non-routable protocol.
如果仍然有问题,请发布屏幕截图和更多详细信息.
If you are still having issues, please post a screen shot and more details.
这篇关于SQL异常:管道的另一端没有进程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!