从ASP.NET连接到SQLServer 2000 [英] Connecting to SQLServer 2000 from ASP.NET

查看:65
本文介绍了从ASP.NET连接到SQLServer 2000的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个连接到SQL Server数据库的ASP.NET应用程序。

SQL Server驻留在IIS5.1上的单独开发服务器上

托管ASP.NET应用程序的开发PC上的Windows XP SP2。

我想使用集成Windows身份验证,例如

集成安全性= SSPI ; Persist Security Info = False; Initial

Catalog = DBName; Data Source = DevServer1


我的问题!

1)ASP .NET将在开发PC上运行,因为

MachineName \IUSR_MachineName,并且在

开发PC上的SQL Server企业管理器下,我想不出办法作为Windows用户添加此用户(位于不同的
机器上)

2.1)我设法在企业管理器中添加MyDomain\AUser作为SQL用户。 br />
2.2)我试图通过编辑让我的ASP.NET作为MyDomain \ AUser运行

C:\ WINDOWS \ MicrosoftMicrosoft.NET \ Framework \v1 0.1。 4322 \CONFI G \ .Machine.config as

关注

< processModel

enable =" true"

timeout =" Infinite"

idleTimeout =" Infinite"

shutdownTimeout =" 0:00:05"

requestLimit =" Infinite"

requestQueueLimit =" 5000"

restartQueueLimit =" 10"

memoryLimit =" 60"

webGarden =" false"

cpuMask =" 0xffffffff"

userName =" MyDomain \AUser"

password =" password"

logLevel =" Errors"

clientConnectedCheck =" 0:00:05"

comAuthenticationLevel ="连接

comImpersonationLevel =" Impersonate"

responseDeadlockInterval =" 00:03:00"

maxWorkerThreads =" 20"

maxIoThreads =" 20"

/>


然而,当我发布时来自IE的ASP.NET应用程序(在它甚至获得
到连接到SQLServer的阶段之前,我在IE上得到错误说

应用程序不可用,并且在事件中观众,我得到了


事件类型:错误

事件来源:ASP.NET 1.1.4322.0

事件类别:无

事件ID:1084

用户:N / A

电脑:MachineName

描述:

aspnet_wp.exe无法启动。失败的错误代码是

80004005.当工作进程帐户具有读取.NET Framework文件的权限不足时,可能会导致此错误。请确保已正确安装

..NET Framework,并且安装

目录中的ACL允许访问已配置的帐户。


有关详细信息,请参阅
上的帮助和支持中心。 http://go.microsoft.com/fwlink/events.asp

事件类型:错误

事件来源:ASP.NET 1.1.4322.0

活动类别:无

活动编号:1007

用户:N / A

计算机:MachineName

描述:

aspnet_wp.exe无法启动,因为配置文件的processModel部分中提供的用户名和/或密码

无效。


有关详细信息,请参阅
http://go.microsoft.com/fwlink/events.asp


我该如何解决这个问题?我100%确定我在machine.config下输入了正确的用户名

和密码,我也做了iisreset!

I have an ASP.NET application that connects to a SQL Server database.

The SQL Server resides on a seperate development server from the IIS5.1 on
Windows XP SP2 on development PCs which host the ASP.NET application.

I would like to use Integrated Windows Authentication like
Integrated Security=SSPI;Persist Security Info=False;Initial
Catalog=DBName;Data Source=DevServer1

My problems!
1) ASP.NET would be running on development PCs as
MachineName\IUSR_MachineName and under SQL Server Enterprise Manager on the
Dev PC, I can''t think of a way to add this user (which is on a different
machine) as a Windows user
2.1) I managed to add MyDomain\AUser as a SQL user in Enterprise Manager.
2.2) I tried to get my ASP.NET to run as MyDomain\AUser by editing
C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\CONFI G\Machine.config as
follows
<processModel
enable="true"
timeout="Infinite"
idleTimeout="Infinite"
shutdownTimeout="0:00:05"
requestLimit="Infinite"
requestQueueLimit="5000"
restartQueueLimit="10"
memoryLimit="60"
webGarden="false"
cpuMask="0xffffffff"
userName="MyDomain\AUser"
password="password"
logLevel="Errors"
clientConnectedCheck="0:00:05"
comAuthenticationLevel="Connect"
comImpersonationLevel="Impersonate"
responseDeadlockInterval="00:03:00"
maxWorkerThreads="20"
maxIoThreads="20"
/>

However, when I launch the ASP.NET application from IE (before it even get
to the stage to connect to SQLServer, I get the error on IE saying
Application Unavailable, and in the Event Viewer, I get

Event Type: Error
Event Source: ASP.NET 1.1.4322.0
Event Category: None
Event ID: 1084
User: N/A
Computer: MachineName
Description:
aspnet_wp.exe could not be started. The error code for the failure is
80004005. This error can be caused when the worker process account has
insufficient rights to read the .NET Framework files. Please ensure that the
..NET Framework is correctly installed and that the ACLs on the installation
directory allow access to the configured account.

For more information, see Help and Support Center at
http://go.microsoft.com/fwlink/events.asp.
Event Type: Error
Event Source: ASP.NET 1.1.4322.0
Event Category: None
Event ID: 1007
User: N/A
Computer: MachineName
Description:
aspnet_wp.exe could not be launched because the username and/or password
supplied in the processModel section of the config file are invalid.

For more information, see Help and Support Center at
http://go.microsoft.com/fwlink/events.asp.

How could I fix this? I am 100% sure I have entered the correct username
and password under machine.config and I did do an iisreset as well!

推荐答案



问题可能不是用户名和密码,而是权利

MyDomain \ Myyser有。例如,我知道用户必须登录

作为批处理作业。用户权利。追踪这些问题的一种方法是

在本地安全策略中启用安全审核,并查看事件日志中出现的内容。


我使用的另一个解决方案是让ASP.NET作为本地

ASPNET帐户执行,但将密码设置为已知密码。在其他

字样中,而不是:


userName =" machine" password =" AutoGenerate"

在machine.config中,使用:


userName =" machine" password =" longpassword"

然后在数据库服务器上,使用

相同的密码创建一个本地ASPNET帐户。对于权利,您需要从

网络访问此计算机,并登录为批处理作业。您可以拒绝本地登录。你需要添加ASPNET作为SQL Server的登录,并授予对

正确数据库的访问权限。


HTH,


-

Scott
http://www.OdeToCode.com

2004年4月22日星期四22:49:31 +0100,Patrick

< pa ** @ reply.newsgroup.msn.com>写道:

The problem may not be the username and password, but in the rights
MyDomain\MyUser has. For instance, I know the user has to have "Log in
as batch job" user rights. One way to track down these problems is to
turn on security auditing in the local security policy and look at
what turns up in the event log.

Another solution I have used is to let ASP.NET execute as the local
ASPNET account but set the password to a known password. In other
words, instead of:

userName="machine" password="AutoGenerate"

in machine.config, use:

userName="machine" password="longpassword"

Then on the database server, create a local ASPNET account with the
same password. For rights, you''ll need "Access this computer from the
network", and "log on as batch job". You can deny local login. You''ll
need to add ASPNET as a login to SQL Server and grant access to the
correct databases of course.

HTH,

--
Scott
http://www.OdeToCode.com
On Thu, 22 Apr 2004 22:49:31 +0100, "Patrick"
<pa**@reply.newsgroup.msn.com> wrote:
我有一个连接到SQL Server数据库的ASP.NET应用程序。

SQL Server驻留在IIS5的单独开发服务器上。 1 on
支持ASP.NET应用程序的开发PC上的Windows XP SP2。

我想使用集成Windows身份验证,如集成安全性= SSPI;持久性安全信息=错误;初始
目录= DBName;数据源= DevServer1

我的问题!
1)ASP.NET将在开发PC上运行
MachineName\IUSR_MachineName在开发者PC上的SQL Server企业管理器下,我想不出一种方法来添加这个用户(在不同的机器上)作为Windows用户
2.1)我设法在企业管理器中添加MyDomain\AUser作为SQL用户。
2.2)我试图通过编辑使我的ASP.NET作为MyDomain \ AUser运行
C:\ WINDOWS \ Microsoft.NET\Framework\v1.1.4322\CONF IG\Machine.conf ig如下
< processModel
enable =" true"
timeout =" Infinite"
idleTimeout =" Infinite"
shutdownTimeout = " 0:00:05"
requestLimit =" Infinite"
requestQueueLimit =" 5000"
restartQueueLimit =" 10"
memoryLimit =" 60"
webGarden =" false"
cpuMask =" 0xffffffff"
userName =" MyDomain \AUser"
password =" password"
logLevel ="错误" ;
clientConnectedCheck =" 0:00:05"
comAuthenticationLevel =" Connect"
comImpersonationLevel =" Impersonate"
responseDeadlockInterval =" 00:03:00"
maxWorkerThreads =" 20"
maxIoThreads = 20
/>

然而,当我从IE启动ASP.NET应用程序时(在它甚至到达连接到SQLServer的阶段之前,我得到了) IE上的错误说
应用程序不可用,并且在事件查看器中,我得到了

事件类型:错误
事件来源:ASP.NET 1.1.4322.0
事件分类:无
活动ID:1084
用户:N / A
计算机:MachineName
说明:
aspnet_wp.exe无法启动。失败的错误代码是
80004005。当工作进程帐户没有足够的权限来读取.NET Framework文件时,可能会导致此错误。请确保已正确安装
.NET Framework,并且安装
目录中的ACL允许访问已配置的帐户。

有关详细信息,请参阅帮助和支持中心。
http://go.microsoft.com/fwlink/events .asp

事件类型:错误
事件来源:ASP.NET 1.1.4322.0
活动类别:无
活动编号:1007 计算机:MachineName
说明:
aspnet_wp.exe无法启动,因为在配置的processModel部分提供的用户名和/或密码
文件无效。

有关详细信息,请参阅
http://go.microsoft.com/fwlink/events.asp

我该如何解决这个问题?我100%确定我在machine.config下输入了正确的用户名
和密码,我也做了iisreset!
I have an ASP.NET application that connects to a SQL Server database.

The SQL Server resides on a seperate development server from the IIS5.1 on
Windows XP SP2 on development PCs which host the ASP.NET application.

I would like to use Integrated Windows Authentication like
Integrated Security=SSPI;Persist Security Info=False;Initial
Catalog=DBName;Data Source=DevServer1

My problems!
1) ASP.NET would be running on development PCs as
MachineName\IUSR_MachineName and under SQL Server Enterprise Manager on the
Dev PC, I can''t think of a way to add this user (which is on a different
machine) as a Windows user
2.1) I managed to add MyDomain\AUser as a SQL user in Enterprise Manager.
2.2) I tried to get my ASP.NET to run as MyDomain\AUser by editing
C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\CONF IG\Machine.config as
follows
<processModel
enable="true"
timeout="Infinite"
idleTimeout="Infinite"
shutdownTimeout="0:00:05"
requestLimit="Infinite"
requestQueueLimit="5000"
restartQueueLimit="10"
memoryLimit="60"
webGarden="false"
cpuMask="0xffffffff"
userName="MyDomain\AUser"
password="password"
logLevel="Errors"
clientConnectedCheck="0:00:05"
comAuthenticationLevel="Connect"
comImpersonationLevel="Impersonate"
responseDeadlockInterval="00:03:00"
maxWorkerThreads="20"
maxIoThreads="20"
/>

However, when I launch the ASP.NET application from IE (before it even get
to the stage to connect to SQLServer, I get the error on IE saying
Application Unavailable, and in the Event Viewer, I get

Event Type: Error
Event Source: ASP.NET 1.1.4322.0
Event Category: None
Event ID: 1084
User: N/A
Computer: MachineName
Description:
aspnet_wp.exe could not be started. The error code for the failure is
80004005. This error can be caused when the worker process account has
insufficient rights to read the .NET Framework files. Please ensure that the
.NET Framework is correctly installed and that the ACLs on the installation
directory allow access to the configured account.

For more information, see Help and Support Center at
http://go.microsoft.com/fwlink/events.asp.
Event Type: Error
Event Source: ASP.NET 1.1.4322.0
Event Category: None
Event ID: 1007
User: N/A
Computer: MachineName
Description:
aspnet_wp.exe could not be launched because the username and/or password
supplied in the processModel section of the config file are invalid.

For more information, see Help and Support Center at
http://go.microsoft.com/fwlink/events.asp.

How could I fix this? I am 100% sure I have entered the correct username
and password under machine.config and I did do an iisreset as well!






嗨Patrick,


从您的描述中,您试图从您的asp.net网络服务器访问

远程服务器上的sqlserver数据库。并且因为你正在使用

集成的Windows身份验证模式来连接sqlserver数据库,你就像ASP.NET网络应用程序一样充当某个域名的b $ b帐户(具有

权限,用于连接sqlserver数据库)。此外,您已尝试更改< processModel>中的帐户

asp.net的元素,但发现

甚至导致网络应用程序无法启动运行,是吗?


至于这个问题,这是我的建议:

1.< processModel> 's帐户设置用于asp.net的'b $ b workerprocess'的执行帐户。它需要许多asp.net指定的权限

,以确保asp.net web applciation可以正常运行。因此,如果您使用域帐户替换它,那么它将导致一些意外的

权限问题导致应用程序无法启动。


2.至于你的情况,我认为asp.net的模仿功能是你想要的

。在访问一些

服务器端资源时,模拟asp.net

可以帮助使用asp.net的自定义帐户。它可以使用

1)来自客户端的用户帐户(由iis传递)

2)在< identity ..>中指定修复accoun。访问服务器端资源时,asp.net使用元素




以下是ASP.NET模拟的一些参考资料;


#ASP.NET模拟
http://msdn.microsoft.com/library/en...etimpersonatio

n.asp?frame = true


#在ASP.NET模拟中使用IIS身份验证
http://msdn.microsoft.com/library/en...giisauthentica

tionwithaspnetimpersonation.asp?frame = true


#INFO :在ASP.NET应用程序中实现模拟
http:// support。 microsoft.com/?id=306158


希望有所帮助。谢谢。


问候,


Steven Cheng

微软在线支持


安全! www.microsoft.com/security

(此帖子按原样提供,不作任何保证,并且不授予

权利。)


在ASP.NET上获取预览whidbey
< a rel =nofollowhref =http://msdn.microsoft.com/asp.net/whidbey/default.aspxtarget =_ blank> http://msdn.microsoft.com/asp.net/whidbey /default.aspx

Hi Patrick,

From your description, you''re trying to access a sqlserver database on a
remote serverfrom your asp.net webserver. and since you ''re using
integrated windows Authentication mode to connect the sqlserver db, you''d
like the ASP.NET web app to act as a certain domain account( which has the
right permission for conecting the sqlserver db). Also, you''ve tried change
the account in the <processModel> element for the asp.net but found that
even cause the web app unable to startup running, yes?

As for this problem, here are my suggestions:
1. The <processModel> ''s account setting is used for the asp.net''s
workerprocess''s execute account. It need many asp.net specified permissions
which make sure that the asp.net web applciation can run properly. So if
you replace it with a domain account, it ''ll cause some unexpected
permission issues which lead to the application uable to startup.

2. As for your situaion, I think the impersonate feature of asp.net is what
you want. The impersonation of asp.net
can help use a customized account for asp.net when accessing some
serverside resources. It can use
1) the user account from the client(passed by iis)
2) specified a fix accoun in the <identity ..> element for asp.net to use
when accessing serverside resources.

Below are some references on ASP.NET impersonation;

#ASP.NET Impersonation
http://msdn.microsoft.com/library/en...etimpersonatio
n.asp?frame=true

#Using IIS Authentication With ASP.NET Impersonation
http://msdn.microsoft.com/library/en...giisauthentica
tionwithaspnetimpersonation.asp?frame=true

#INFO: Implementing Impersonation in an ASP.NET Application
http://support.microsoft.com/?id=306158

Hope helps. Thanks.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Get Preview at ASP.NET whidbey
http://msdn.microsoft.com/asp.net/whidbey/default.aspx


不幸的是,

1)我的ASP.NET似乎完全停止了工作!现在,即使有
还原我的machine.config到

< identity impersonate =" false"的userName = QUOT;"密码="" />


< processModel

enable =" true"

timeout ="无限

idleTimeout ="无限

shutdownTimeout =" 0:00:05"

requestLimit =" Infinite"

requestQueueLimit =" 5000"

restartQueueLimit =" 10"

memoryLimit =" 60"

webGarden = " false"

cpuMask =" 0xffffffff"

userName =" machine"

password =" AutoGenerate"

logLevel ="错误"

clientConnectedCheck =" 0:00:05"

comAuthenticationLevel =" Connect"

comImpersonationLevel =" Impersonate"

responseDeadlockInterval =" 00:03:00"

maxWorkerThreads =" 20"

maxIoThreads =" 20

/>


我的IIS甚至不会渲染test.aspx,其中包含:

<%@ Page language =" C#" AutoEventWireup = QUOT假QUOT; %>

<!DOCTYPE HTML PUBLIC" - // W3C // DTD HTML 4.0 Transitional // EN" >

< HTML>

< HEAD>

< meta name =" GENERATOR" Content =" Microsoft Visual Studio 7.0"

< meta name =" CODE_LANGUAGE" Content =" C#">

< meta name =" vs_defaultClientScript" content =" JavaScript">

< meta name =" vs_targetSchema"

content =" http://schemas.microsoft.com/intellisense/ie5" ;>

< META http-equiv =" Expires" content =" 0">

< META http-equiv =" Pragma" content =" no-cache">

< META http-equiv =" Cache-Control" content =" no-cache">

< / HEAD>


< body>

好​​吗?

< / body>

< / HTML>

我得到相同的错误服务器应用程序不可用我完成了IISRESET后出现了错误,那就是



在此之前,我尝试将processModel作为DomainUser运行,这是一个

本地管理员的成员和调试器用户有权利的团体

作为批处理工作登录等。


SOS!


Steven Cheng [MSFT] QUOT; <,V - ****** @ online.microsoft.com>在消息中写道

news:ji ************** @ cpmsftngxa10.phx.gbl ...
Unfortunately,
1) My ASP.NET seems to have stopped working completely! Now, even having
reverted my machine.config to
<identity impersonate="false" userName="" password=""/>

<processModel
enable="true"
timeout="Infinite"
idleTimeout="Infinite"
shutdownTimeout="0:00:05"
requestLimit="Infinite"
requestQueueLimit="5000"
restartQueueLimit="10"
memoryLimit="60"
webGarden="false"
cpuMask="0xffffffff"
userName="machine"
password="AutoGenerate"
logLevel="Errors"
clientConnectedCheck="0:00:05"
comAuthenticationLevel="Connect"
comImpersonationLevel="Impersonate"
responseDeadlockInterval="00:03:00"
maxWorkerThreads="20"
maxIoThreads="20"
/>

My IIS won''t even render a test.aspx which contains:
<%@ Page language="C#" AutoEventWireup="false" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<meta name="GENERATOR" Content="Microsoft Visual Studio 7.0">
<meta name="CODE_LANGUAGE" Content="C#">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema"
content="http://schemas.microsoft.com/intellisense/ie5">
<META http-equiv="Expires" content="0">
<META http-equiv="Pragma" content="no-cache">
<META http-equiv="Cache-Control" content="no-cache">
</HEAD>

<body>
OK?
</body>
</HTML>

I get the same error "Server Application Unavailable" error, and that is
after I have done IISRESET.

Before this, I have tried running processModel as a DomainUser that is a
member of the local "Administrators" and "Debugger Users" group with rights
to logon as a batch job, etc.

SOS!

"Steven Cheng[MSFT]" <v-******@online.microsoft.com> wrote in message
news:ji**************@cpmsftngxa10.phx.gbl...
嗨Patrick,

根据您的描述,您试图从您的asp.net网络服务器访问远程服务器上的sqlserver数据库。并且由于您正在使用集成的Windows身份验证模式来连接sqlserver数据库,您将像ASP.NET Web应用程序一样充当某个域帐户(具有
合适sqlserver db的权限)。此外,您已尝试
更改< processModel>中的帐户asp.net的元素但是发现
甚至导致web应用程序无法启动运行,是吗?

至于这个问题,这里有我的建议:
1. <中processModel> 's帐户设置用于asp.net的
workerprocess'的执行帐户。它需要许多asp.net指定的
权限,以确保asp.net web applciation可以正常运行。因此,如果您使用域帐户替换它,则会导致一些意外的权限问题导致应用程序无法启动。

2.至于您的情况,我认为asp.net的模仿功能是你想要的
。在访问一些
服务器端资源时,模拟asp.net
可以帮助使用asp.net的自定义帐户。它可以使用
1)来自客户端的用户帐户(由iis传递)
2)在< identity ..>中指定修复accoun。访问服务器端资源时asp.net使用的元素。

下面是一些关于ASP.NET模拟的参考文献;

#ASP.NET模拟 http://msdn.microsoft.com/library /en...etimpersonatio n.asp?frame = true

#使用ASP.NET模拟进行IIS身份验证
http://msdn.microsoft.com/library/en...giisauthentica tionwithaspnetimpersonation.asp ?frame = true

#INFO:在ASP.NET应用程序中实现模拟
http://support.microsoft.com/?id=306158
希望有所帮助。谢谢。

问候,

Steven Cheng
微软在线支持

获得安全! www.microsoft.com/security
(此帖已提供按原样,没有任何保证,也没有授予
权利。)

在ASP.NET上预览whidbey
http://msdn.microsoft.com/asp.net/whidbey/default.aspx
Hi Patrick,

From your description, you''re trying to access a sqlserver database on a
remote serverfrom your asp.net webserver. and since you ''re using
integrated windows Authentication mode to connect the sqlserver db, you''d
like the ASP.NET web app to act as a certain domain account( which has the
right permission for conecting the sqlserver db). Also, you''ve tried change the account in the <processModel> element for the asp.net but found that
even cause the web app unable to startup running, yes?

As for this problem, here are my suggestions:
1. The <processModel> ''s account setting is used for the asp.net''s
workerprocess''s execute account. It need many asp.net specified permissions which make sure that the asp.net web applciation can run properly. So if
you replace it with a domain account, it ''ll cause some unexpected
permission issues which lead to the application uable to startup.

2. As for your situaion, I think the impersonate feature of asp.net is what you want. The impersonation of asp.net
can help use a customized account for asp.net when accessing some
serverside resources. It can use
1) the user account from the client(passed by iis)
2) specified a fix accoun in the <identity ..> element for asp.net to use
when accessing serverside resources.

Below are some references on ASP.NET impersonation;

#ASP.NET Impersonation
http://msdn.microsoft.com/library/en...etimpersonatio n.asp?frame=true

#Using IIS Authentication With ASP.NET Impersonation
http://msdn.microsoft.com/library/en...giisauthentica tionwithaspnetimpersonation.asp?frame=true

#INFO: Implementing Impersonation in an ASP.NET Application
http://support.microsoft.com/?id=306158

Hope helps. Thanks.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Get Preview at ASP.NET whidbey
http://msdn.microsoft.com/asp.net/whidbey/default.aspx



这篇关于从ASP.NET连接到SQLServer 2000的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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