用户'(null)'登录失败。原因:与受信任的SQL Server连接无关。 [英] Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection.

查看:245
本文介绍了用户'(null)'登录失败。原因:与受信任的SQL Server连接无关。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用最新的SP Win2k和.NET版本,我在server1上运行了一个运行

的.NET应用程序,并在server2上运行了一个SQL Server数据库。我为server1 \ aspnet提供了

Windows用户帐户密码sync(由.NET安装)
框架和server2 \ aspnet(由我创建 - 这个机器没有.NET

框架就可以了。数据库服务器上的aspnet用户(server2)对数据库有
访问权限。


我仍​​然得到:用户''(null)''登录失败。原因:与

可信SQL Server连接无关。


IIS设置为Windows集成身份验证...虽然结果与

匿名,有和没有IIS控制密码我输入。


--- --------------------------------

这是'我的连接字符串:


Me.SqlConnection1.ConnectionString =" workstation id ="" CIL-094"" ;; packet

size = 4096; integrated security = SSPI; data source =""" myserver"" ;; persist security

info = False; initial catalog = mydb;" ;

-----------------------------------

这里是我的web.config:


<?xml version =" 1.0"编码= QUOT; UTF-8英寸?>

< configuration>

< system.web>


< compilation defaultLanguage =" vb"调试= QUOT;真" />

< customErrors mode =" Off" >

< error statusCode =" 404"重定向= QUOT;〜/错误/ missingPage.aspx" />

< / customErrors>

< authentication mode =" Windows" />


< authorization>

< allow users =" *" /> < / authorization>


< trace enabled =" true" requestLimit = QUOT; 10" pageOutput =" true"

traceMode =" SortByTime" localOnly =" true" />


< sessionState

mode =" InProc"

stateConnectionString =" tcpip = 127.0.0.1:42424"

sqlConnectionString =" data source = 127.0.0.1;"

cookieless =" false"

timeout =" 20"

/>


< globalization requestEncoding =" utf-8"的ResponseEncoding = QUOT; UTF-8英寸/>

< /system.web>

< / configuration>


-

_____

DC G

Using latest SP Win2k and .NET versions, I have a .NET application running
on server1 with a SQL Server database running on server2. I have the
Windows user account passwords sync''d for server1\aspnet (installed by .NET
Framework and server2\aspnet (created by me--this machine has no .NET
Framework on it). The aspnet user on the database server (server2) has
access to the database.

I still get: Login failed for user ''(null)''. Reason: Not associated with a
trusted SQL Server connection.

IIS is set to Windows Integrated Authentication...although same result with
Anonymous, with and without IIS controlling password that I enter.

-----------------------------------
Here''s my connection string:

Me.SqlConnection1.ConnectionString = "workstation id=""CIL-094"";packet
size=4096;integrated security=SSPI;data source=""myserver"";persist security
info=False;initial catalog=mydb;"
-----------------------------------
Here''s my web.config:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.web>

<compilation defaultLanguage="vb" debug="true" />
<customErrors mode="Off" >
<error statusCode="404" redirect="~/errors/missingPage.aspx" />
</customErrors>
<authentication mode="Windows" />

<authorization>
<allow users="*" /> </authorization>

<trace enabled="true" requestLimit="10" pageOutput="true"
traceMode="SortByTime" localOnly="true"/>

<sessionState
mode="InProc"
stateConnectionString="tcpip=127.0.0.1:42424"
sqlConnectionString="data source=127.0.0.1;"
cookieless="false"
timeout="20"
/>

<globalization requestEncoding="utf-8" responseEncoding="utf-8" />
</system.web>
</configuration>

--
_____
DC G

推荐答案

这是我不知情的理解 - 我可能完全错了

这个! :-)


在我看来,ASP.NET作为Server1 \ASPNET运行,这是一个帐户

网络服务器本地。它的访问令牌可能只对网络资源具有匿名

权限,这不足以登录到远程盒子上的SQL Server

。您在server2上的ASPNET帐户是

Server2 \ASPNET,这是不一样的。


干杯

Ken

" DC Gringo" <直流****** @ visiontechnology.net>在消息中写道

新闻:eS ************** @ TK2MSFTNGP12.phx.gbl ...
This is my uninformed understanding - I could be completely wrong about
this! :-)

Seems to me that ASP.NET is running as Server1\ASPNET which is an account
local to the webserver. It''s access token probably only has "anonymous"
rights to network resources, which isn''t sufficient to login to SQL Server
on the remote box. The ASPNET account you have on server2, is
Server2\ASPNET, which isn''t the same.

Cheers
Ken
"DC Gringo" <dc******@visiontechnology.net> wrote in message
news:eS**************@TK2MSFTNGP12.phx.gbl...
使用最新的SP Win2k和在.NET版本中,我在server1上运行了一个运行
的.NET应用程序,在server2上运行了一个SQL Server数据库。我已经为server1 \ aspnet同步了
Windows用户帐户密码(由.NET
.NET安装
Framework和server2 \ aspnet(由我创建 - 这台机器没有。 NET
框架就可以了。数据库服务器上的aspnet用户(server2)可以访问数据库。

我仍然得到:用户登录失败''(null )''。原因:与
可信的SQL Server连接无关。

IIS设置为Windows集成身份验证...虽然结果相同
匿名,有和没有IIS控制我输入的密码。

--------------------------- --------
这是我的连接字符串:

Me.SqlConnection1.ConnectionString =" workstation id ="" CIL-094"" ;;数据包
大小= 4096;集成安全性= SSPI;数据源="" myserver"" ;; persist
安全性
info = False;初始目录= mydb;"

------------------------------- ----
这是我的web.config:

<?xml version =" 1.0"编码= QUOT; UTF-8英寸?>
< configuration>
< system.web>

< compilation defaultLanguage =" vb"调试= QUOT;真" />
< customErrors mode =" Off" >
< error statusCode =" 404"重定向= QUOT;〜/错误/ missingPage.aspx" />
< / customErrors>
< authentication mode =" Windows" />

< authorization>
< allow users =" *" /> < / authorization>

< trace enabled =" true" requestLimit = QUOT; 10" pageOutput =" true"
traceMode =" SortByTime" localOnly =" true" />

< sessionState
mode =" InProc"
stateConnectionString =" tcpip = 127.0.0.1:42424"
sqlConnectionString =" data source = 127.0.0.1;"
cookieless =" false"
timeout =" 20"
/>

<全球化请求编码=" utf-8"的ResponseEncoding = QUOT; UTF-8英寸/>
< /system.web>
< / configuration>

-
_____
DC G
Using latest SP Win2k and .NET versions, I have a .NET application running
on server1 with a SQL Server database running on server2. I have the
Windows user account passwords sync''d for server1\aspnet (installed by
.NET
Framework and server2\aspnet (created by me--this machine has no .NET
Framework on it). The aspnet user on the database server (server2) has
access to the database.

I still get: Login failed for user ''(null)''. Reason: Not associated with
a
trusted SQL Server connection.

IIS is set to Windows Integrated Authentication...although same result
with
Anonymous, with and without IIS controlling password that I enter.

-----------------------------------
Here''s my connection string:

Me.SqlConnection1.ConnectionString = "workstation id=""CIL-094"";packet
size=4096;integrated security=SSPI;data source=""myserver"";persist
security
info=False;initial catalog=mydb;"
-----------------------------------
Here''s my web.config:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.web>

<compilation defaultLanguage="vb" debug="true" />
<customErrors mode="Off" >
<error statusCode="404" redirect="~/errors/missingPage.aspx" />
</customErrors>
<authentication mode="Windows" />

<authorization>
<allow users="*" /> </authorization>

<trace enabled="true" requestLimit="10" pageOutput="true"
traceMode="SortByTime" localOnly="true"/>

<sessionState
mode="InProc"
stateConnectionString="tcpip=127.0.0.1:42424"
sqlConnectionString="data source=127.0.0.1;"
cookieless="false"
timeout="20"
/>

<globalization requestEncoding="utf-8" responseEncoding="utf-8" />
</system.web>
</configuration>

--
_____
DC G



DC,


你在AD领域吗?如果没有 - 你将无法在机器上跳过你的

身份,但仍然有其他一些选择。


(从那以后已经有一段时间了我已经解决了这个问题 - 但是我会从

内存中尽力而为。


1:您可以启用基本身份验证而不是NTLM - 虽然这不是非常安全的 - 它将允许您提供给网站的凭据

被传递(明文)到包含sql数据库的服务器 - 只需

授权经过身份验证的帐户访问数据库。


2.使用
中的Identity节点在您的网站上设置模拟
web.config - 将NTLM保留在您的网站上,并授予您的身份,即

冒充访问数据库(这也需要额外的设置才能获得
asp .net processModel - 或者提升ASPNET帐户能够做到这一点

身份模仿),如果你在AD领域你可以让网络

应用程序冒充NTLM用户 - 否则您可以在身份节点中指定一个特定的代理帐户 - 并使用

aspnet_setreg.exe对其进行加密。


3.我发现同步你的密码不太适用于任何

扫描 - 虽然这可能会在NT工作 - 我不会t相信窗户

仍然愚蠢到可以摔倒。

这应该会给你足够的信息来解决问题。


祝你好运!


" DC Gringo" <直流****** @ visiontechnology.net>在消息中写道

新闻:eS ************** @ TK2MSFTNGP12.phx.gbl ...
DC,

Are you in an AD realm? If not - you will not be able to hop your
identities across the machines, but still have a few other options.

(its been a while since i''ve tackled the problem - but i''ll do my best from
memory).

1: You can enable Basic Authentication instead of NTLM - while this is not
very secure - it will allow your credentials you supplied to the web site to
be passed (clear text) to the server which contains the sql database - just
grant the authenticated account access to the DB.

2. Setup impersonation on your web site, using the Identity node in the
web.config - keep NTLM on your site, and grant your identity that you
impersonate access to the database (this also requires additional setup to
the asp.net processModel - or elevating the ASPNET account to be able to do
identity impersonation), if you are in an AD realm you can let the web
application impersonate the NTLM user - otherwise you can specificy a
specific proxy account in the identity node - and encrypt it using the
aspnet_setreg.exe.

3. I find it unlikely that syncing your passwords would work in any
scanrio - while this would have worked back in NT - I don''t believe windows
is still dumb enough to fall for it.
This should give you enough information to poke around and get it right.

Good Luck!

"DC Gringo" <dc******@visiontechnology.net> wrote in message
news:eS**************@TK2MSFTNGP12.phx.gbl...
使用最新的SP Win2k和在.NET版本中,我在server1上运行了一个运行
的.NET应用程序,在server2上运行了一个SQL Server数据库。我已经为server1 \ aspnet同步了
Windows用户帐户密码(由.NET
.NET安装
Framework和server2 \ aspnet(由我创建 - 这台机器没有。 NET
框架就可以了。数据库服务器上的aspnet用户(server2)可以访问数据库。

我仍然得到:用户登录失败''(null )''。原因:与
可信的SQL Server连接无关。

IIS设置为Windows集成身份验证...虽然结果相同
匿名,有和没有IIS控制我输入的密码。

--------------------------- --------
这是我的连接字符串:

Me.SqlConnection1.ConnectionString =" workstation id ="" CIL-094"" ;;数据包
大小= 4096;集成安全性= SSPI;数据源="" myserver"" ;; persist
安全性
info = False;初始目录= mydb;"

------------------------------- ----
这是我的web.config:

<?xml version =" 1.0"编码= QUOT; UTF-8英寸?>
< configuration>
< system.web>

< compilation defaultLanguage =" vb"调试= QUOT;真" />
< customErrors mode =" Off" >
< error statusCode =" 404"重定向= QUOT;〜/错误/ missingPage.aspx" />
< / customErrors>
< authentication mode =" Windows" />

< authorization>
< allow users =" *" /> < / authorization>

< trace enabled =" true" requestLimit = QUOT; 10" pageOutput =" true"
traceMode =" SortByTime" localOnly =" true" />

< sessionState
mode =" InProc"
stateConnectionString =" tcpip = 127.0.0.1:42424"
sqlConnectionString =" data source = 127.0.0.1;"
cookieless =" false"
timeout =" 20"
/>

<全球化请求编码=" utf-8"的ResponseEncoding = QUOT; UTF-8英寸/>
< /system.web>
< / configuration>

-
_____
DC G
Using latest SP Win2k and .NET versions, I have a .NET application running
on server1 with a SQL Server database running on server2. I have the
Windows user account passwords sync''d for server1\aspnet (installed by
.NET
Framework and server2\aspnet (created by me--this machine has no .NET
Framework on it). The aspnet user on the database server (server2) has
access to the database.

I still get: Login failed for user ''(null)''. Reason: Not associated with
a
trusted SQL Server connection.

IIS is set to Windows Integrated Authentication...although same result
with
Anonymous, with and without IIS controlling password that I enter.

-----------------------------------
Here''s my connection string:

Me.SqlConnection1.ConnectionString = "workstation id=""CIL-094"";packet
size=4096;integrated security=SSPI;data source=""myserver"";persist
security
info=False;initial catalog=mydb;"
-----------------------------------
Here''s my web.config:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.web>

<compilation defaultLanguage="vb" debug="true" />
<customErrors mode="Off" >
<error statusCode="404" redirect="~/errors/missingPage.aspx" />
</customErrors>
<authentication mode="Windows" />

<authorization>
<allow users="*" /> </authorization>

<trace enabled="true" requestLimit="10" pageOutput="true"
traceMode="SortByTime" localOnly="true"/>

<sessionState
mode="InProc"
stateConnectionString="tcpip=127.0.0.1:42424"
sqlConnectionString="data source=127.0.0.1;"
cookieless="false"
timeout="20"
/>

<globalization requestEncoding="utf-8" responseEncoding="utf-8" />
</system.web>
</configuration>

--
_____
DC G





Web服务器ASPNET帐户可能无法与Server2(SQL)正确映射。

只需删除在SQL Server中的ASPNET acocunt,并创建一个Nt帐户,如

Server1 \ AspNet(不是SQL服务帐户)。


如果没有工作创建Web服务器中的新帐户并分配给工作人员

进程帐户并在Sql Server中引用相同的帐户。


问候,

Govind。

" DC Gringo"写道:

The webserver ASPNET account may not be properly mapped with Server2(SQL).
Just delete the ASPNET acocunt in sql server, and create a Nt Account like
Server1\AspNet (Not a SQL serve account).

if nothing is working create a new Account in Webserver and assign to Worker
process account and refer the same account in Sql Server too.

Regards,
Govind.
"DC Gringo" wrote:
使用最新的SP Win2k和.NET版本,我在server1上运行了一个运行
的.NET应用程序,在server2上运行了一个SQL Server数据库。我有用于server1 \ aspnet的
Windows用户帐户密码sync(由.NET安装)和server2 \ aspnet(由我创建 - 这台机器没有.NET
框架)。数据库服务器(server2)上的aspnet用户可以访问数据库。

我仍然得到:用户''(null)''登录失败。原因:与可信的SQL Server连接无关。

IIS设置为Windows集成身份验证...虽然与匿名相同,但有和没有IIS控制密码我进去了。

-----------------------------------
这是我的连接字符串:

Me.SqlConnection1.ConnectionString =" workstation id ="" CIL-094"" ;; packet
size = 4096; integrated security = SSPI;数据源="" myserver"" ;; persist security
info = False; initial catalog = mydb;"

----------- ------------------------
在这里y web.config:

<?xml version =" 1.0"编码= QUOT; UTF-8英寸?>
< configuration>
< system.web>

< compilation defaultLanguage =" vb"调试= QUOT;真" />
< customErrors mode =" Off" >
< error statusCode =" 404"重定向= QUOT;〜/错误/ missingPage.aspx" />
< / customErrors>
< authentication mode =" Windows" />

< authorization>
< allow users =" *" /> < / authorization>

< trace enabled =" true" requestLimit = QUOT; 10" pageOutput =" true"
traceMode =" SortByTime" localOnly =" true" />

< sessionState
mode =" InProc"
stateConnectionString =" tcpip = 127.0.0.1:42424"
sqlConnectionString =" data source = 127.0.0.1;"
cookieless =" false"
timeout =" 20"
/>

<全球化请求编码=" utf-8"的ResponseEncoding = QUOT; UTF-8英寸/>
< /system.web>
< / configuration>

-
_____
DC G
Using latest SP Win2k and .NET versions, I have a .NET application running
on server1 with a SQL Server database running on server2. I have the
Windows user account passwords sync''d for server1\aspnet (installed by .NET
Framework and server2\aspnet (created by me--this machine has no .NET
Framework on it). The aspnet user on the database server (server2) has
access to the database.

I still get: Login failed for user ''(null)''. Reason: Not associated with a
trusted SQL Server connection.

IIS is set to Windows Integrated Authentication...although same result with
Anonymous, with and without IIS controlling password that I enter.

-----------------------------------
Here''s my connection string:

Me.SqlConnection1.ConnectionString = "workstation id=""CIL-094"";packet
size=4096;integrated security=SSPI;data source=""myserver"";persist security
info=False;initial catalog=mydb;"
-----------------------------------
Here''s my web.config:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.web>

<compilation defaultLanguage="vb" debug="true" />
<customErrors mode="Off" >
<error statusCode="404" redirect="~/errors/missingPage.aspx" />
</customErrors>
<authentication mode="Windows" />

<authorization>
<allow users="*" /> </authorization>

<trace enabled="true" requestLimit="10" pageOutput="true"
traceMode="SortByTime" localOnly="true"/>

<sessionState
mode="InProc"
stateConnectionString="tcpip=127.0.0.1:42424"
sqlConnectionString="data source=127.0.0.1;"
cookieless="false"
timeout="20"
/>

<globalization requestEncoding="utf-8" responseEncoding="utf-8" />
</system.web>
</configuration>

--
_____
DC G



这篇关于用户'(null)'登录失败。原因:与受信任的SQL Server连接无关。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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