如何启用Web服务器来创建数据库? [英] How do I enable the web server to create a database?

查看:59
本文介绍了如何启用Web服务器来创建数据库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Windows XP Professional SP2上安装了Visual Studio 2005 Team Suite Beta 2,包括SQL Server

2005 Express Edition April CTP,包括IIS

5.1。 SQL Server(SQLEXRPESS)服务在NT

AUTHORITY \ NETWORK SERVICE帐户下运行。这台机器名为VSDev01WSWP01。


我还在名为

VSDev01SQL02的Windows Server 2003计算机上运行SQL Server 2000。这台计算机包含我的应用程序的数据库,我将它与aspnet_regsql工具创建的表集成在一起。


这是前几行C:\Inetpub\wwwroot \ WebPortal \web.config,

包括AspNetSqlProvider:

<?xml version =" 1.0"?> ;

< configuration xmlns =" http://schemas.microsoft.com/.NetConfiguration/v2.0">

< connectionStrings>

< add name =" SqlServices"

connectionString =" Provider = SQLOLEDB; Server = VSDev01 SSQL02; Integrated

Security = SSPI; Data Source = Web Portal; Initial Catalog = WebPortal;" />

< / connectionStrings>

< system.web>

< membership userIsOnlineTimeWindow =" 60">

< providers>

< add description =" Web Portal" connectionStringName =" SqlServices"

enablePasswordRetrieval =" false" enablePasswordReset =" true"

requiresQuestionAndAnswer =" true"

passwordFormat =" Hashed" requiresUniqueEmail =" false"

applicationName =" /"

name =" AspNetSqlProvider"

type =" System.Web .Security.SqlMembershipProvider" />

< / providers>

< / membership>


来自Visual Studio 2005的网站菜单,我选择了ASP.NET配置,

然后点击了Provider Configuration链接。然后,我选择了为所有站点管理数据选择一个

单一提供商,然后点击测试按钮。链接

旁边的AspNetSqlProvider。这产生了以下错误:


''/asp.netwebadminfiles''应用程序中的服务器错误

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

由于

失败而无法生成SQL Server的用户实例用户实例的过程。连接将被关闭。


描述:在执行

当前Web请求期间发生了未处理的异常。请查看堆栈跟踪,了解有关

错误及其在代码中的起源的更多信息。


SQLExpress数据库文件自动创建错误:

....


错误消息提到需要对

App_Data目录进行各种形式的访问,因此我授予了完全控制权限用户,网络服务和

ASPNET。我还让ASPNET成为本地管理员。我还验证了SQL

Server Express已经安装并运行。


因此,我已经得出结论,我需要授予本地

ASPNET帐户,理论上由IIS使用,dbcreator

priviledge在SQL Server Express中。但是,这个精简产品

不包含企业管理器或查询分析器,所以我不知道怎么做

那个。我怎样才能授予这种权利?

I have installed Visual Studio 2005 Team Suite Beta 2, including SQL Server
2005 Express Edition April CTP, on Windows XP Professional SP2, including IIS
5.1. The SQL Server (SQLEXRPESS) service is running under the NT
AUTHORITY\NETWORK SERVICE account. This machine is named VSDev01WSWP01.

I am also running SQL Server 2000 on a Windows Server 2003 computer named
VSDev01SQL02. This computer contains my application''s database, which I have
integrated with the tables created by the aspnet_regsql tool.

Here are the first few lines of C:\Inetpub\wwwroot\WebPortal\web.config,
which includes AspNetSqlProvider:
<?xml version="1.0"?>
<configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
<connectionStrings>
<add name="SqlServices"
connectionString="Provider=SQLOLEDB;Server=VSDev01 SSQL02;Integrated
Security=SSPI;Data Source=Web Portal;Initial Catalog=WebPortal;" />
</connectionStrings>
<system.web>
<membership userIsOnlineTimeWindow="60">
<providers>
<add description="Web Portal" connectionStringName="SqlServices"
enablePasswordRetrieval="false" enablePasswordReset="true"
requiresQuestionAndAnswer="true"
passwordFormat="Hashed" requiresUniqueEmail="false"
applicationName="/"
name="AspNetSqlProvider"
type="System.Web.Security.SqlMembershipProvider" />
</providers>
</membership>

From Visual Studio 2005''s Website menu, I selected ASP.NET Configuration,
then clicked the Provider Configuration link. I then selected "Select a
single provider for all site management data," then clicked the "Test" link
besider AspNetSqlProvider. This produced the following error:

Server Error in ''/asp.netwebadminfiles'' Application
--------------------------------------------------------------------------------
Failed to generate a user instance of SQL Server due to a failure in
starting the process for the user instance. The connection will be closed.

Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information about
the error and where it originated in the code.

SQLExpress database file auto-creation error:
....

The error message mentions the need for various forms of access to the
App_Data directory, so I granted Full Control to USERS, NETWORK SERVICE, and
ASPNET. I also made ASPNET a local administrator. I also verified that SQL
Server Express is installed and running.

Therefore, I have reached the conclusion that I need to grant the local
ASPNET account, which theoretically is being used by IIS, dbcreator
priviledge in SQL Server Express. However, this stripped-down product
contains no Enterprise Manager or Query Analyzer, so I do not know how to do
that. How can I grant that priviledge?

推荐答案

您好,


感谢您在此发帖。

从您的描述中,您有一个带有Visual Studio 2005团队的XP sp2框

Suite Beta 2(也是SQL Server

2005 Express Edition April CTP)安装。当您尝试为ASP.NET Web应用程序使用

SqlServer提供程序时,会出现一些错误

表示sqlserver实例未正确建立,是吗?


至于你描述的问题,有一件事让我有点困惑是

你正在配置会员服务以使用远程sqlserver

2003服务器上的数据库,但错误信息说明了一些不正确的内容与

的App_Data文件夹。基于我当地的BETA2测试,当我没有显示为会员配置远程数据源并配置为使用SqlServer Provider时,它会自动创建
我的本地SQL Server 2005 Express Edition April CTP和ASPNETDB.MDF

文件中的所需数据库将出现在App_Data子目录中。如果您删除了

远程数据库配置并尝试使用本地SQL Server 2005 Express

版作为成员资格提供程序,会发生什么?是否还会产生这样的错误?


此外,您还可以将此问题发布到新的MSDN论坛上

web以查看是否有其他社区成员遇到过类似的问题。

http://forums.microsoft.com/msdn/


谢谢,


Steven Cheng

Microsoft在线支持


安全! www.microsoft.com/security

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

权利。)

Hi,

Thanks for posting here.
From your description, you''ve a XP sp2 box with Visual Studio 2005 Team
Suite Beta 2(alsoSQL Server
2005 Express Edition April CTP) installed. When you try to use the
SqlServer Provider for the ASP.NET web application ,here occurs some error
indicate that the sqlserver instance wasn''t correctly established, yes?

As for the problem you described, one thing made me a bit confused was
you''re configuring the Membership service to use the remote sqlserver
database on a 2003 server, but the error info said something incorrect with
the App_Data folder. Based on my local BETA2 testing, when I don''t
explicitly configure a remote datasource for membership and configure to
use the SqlServer Provider, it''ll automatically create the required db in
my local SQL Server 2005 Express Edition April CTP and the ASPNETDB.MDF
file will occur in the App_Data sub dir. What''ll happen if you remove your
remote db configuration and try using the local SQL Server 2005 Express
Edition to perform as the membership provider? Will it also
throw such error?

In addition, you can also post the this issue to the new MSDN forum on the
web to see whether any other community members have encountered the
similiar problom.

http://forums.microsoft.com/msdn/

Thanks,

Steven Cheng
Microsoft Online Support

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


是的,你似乎理解这个问题。


我试着按照你在web.config中的建议去做什么:

1.在connectionString中,我将服务器更改为VSDev01WSWP01(本地XP

机器),然后我完全删除了Server条目。两次我都收到了与之前相同的错误。

2.在AspNetSqlProvider提供程序中,我注释掉了

" connectionStringName = SqlServices" 。这使情况变得更糟。我收到的错误是:您正在尝试的应用程序访问被拒绝
管理。


所以,这让我回到了我开始的地方。


但是,我想同情原始问题,错误信息

陈述,网络用于连接到SQL Server Express的服务器帐户必须

有权创建新数据库。由于我运行的是IIS 5.1,因此

消息表明默认的Web服务器帐户是本地ASPNET

计算机帐户。我想尝试授予此帐户dbcreator

priviledge,但我不知道如何。使用企业管理器或查询分析器,SQL Server Express似乎不会带来
,所以我知道如何输入

命令来授予该特权。


此外,当我尝试使用SQL Server 2000中的企业管理器或查询分析器从VSDev01SSQL02

连接到SQL Server Express时,我会收到
消息,SQL Server不存在或访问被拒绝。我是以bb登录为域管理员并使用Windows身份验证。
Yes, you seem to understand the problem.

I tried to do what you suggested in web.config:
1. In connectionString, I changed the Server to VSDev01WSWP01 (the local XP
machine), then I removed the Server entry completely. Both times I received
the same error as before.
2. in the AspNetSqlProvider provider, I commented out
"connectionStringName=SqlServices". This made it even worse. The error I
received was "Access is denied for the application you are attempting to
administer."

So, that leaves me back where I started.

However, I want to empathize that in the original problem, the error message
stated, "The web server account used to connect to SQL Server Express must
have rights to create a new database." Since I am running IIS 5.1, the
message stated that the default web server account is the local ASPNET
machine account. I want to try granting this account the dbcreator
priviledge, but I do not know how. SQL Server Express does not seem to come
with Enterprise Manager or Query Analyzer, so I do know how to enter a
command to grant that priviledge.

Furthermore, when I try to connect to SQL Server Express from VSDev01SSQL02
using either Enterprise Manager or Query Analyzer from SQL Server 2000, I
receive the message, "SQL Server does not exist or access denied." I am
logged in as a Domain Admin and using Windows authentication.


感谢您的回复和进一步的详细说明。


在我的最后一条消息之后,我很清楚地意识到你在IIS中通过HTTP创建了你的ASP.NET 2.0

网站,而我总是使用FileSystem。当使用

FileSystem时,VS.NET 2005使用测试网络服务器来运行web app / admin

应用程序,默认情况下它使用NTLM身份验证,因此执行帐户

是当前的登录用户。但是,当使用Http服务器(IIS)时,默认情况下

Web应用程序集成了Windows身份验证,并允许在IIS虚拟目录中使用无比的
。然后,我们导航到Web管理页面,当前

执行上下文是IIS的匿名帐户。由于匿名帐户

是一个非常受限制的帐户,因此它没有足够的权限来创建sqldatabase。至于我当地的测试,我得到了这种行为。所以

我认为你可以尝试以下方法:


1.在IIS中通过HTTP创建一个新的Web应用程序。并在Web管理页面中测试SQLserver

提供程序以查看是否也出现错误。


2.如果发生,请检查IIS虚拟目录'' ;目录安全性设置为

查看是否允许匿名访问,如果是,则取消选中(确保使用
集成窗口)。然后,重新启动Web管理页面并重试。


3.通过文件系统创建一个新的Web应用程序,看看我们是否可以正确测试ASPSqlProvider
/>

#当执行上述测试时,不要在

web.config中添加任何自定义配置,因为有会员资格的默认配置提供商或

机器级配置中的其他服务。


希望有帮助。谢谢,


Steven Cheng

微软在线支持


安全! www.microsoft.com/security

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

权利。)

Thanks for your response and the further detailed description.

After my last message, I sudently realize that you created your ASP.NET 2.0
website through HTTP in IIS while I always use FileSystem. When using
FileSystem, the VS.NET 2005 use test webserver to run the web app / admin
app, and by default it use NTLM authentication , so the executing account
is the current logon user. However, when using Http sever(IIS), by default
the web application integrated windows authentication and allow anomymous
in IIS virtual dir. Then, we navigate to the web admin page, the current
executing context is the IIS''s anomymous account. Since anomymous account
is a very restricted account, it hasn''t the sufficient permissions to
create the sqldatabase. As far as my local tests, I got this behavior. So
I think you can try the following things:

1. Create a new web application through HTTP in IIS. And test SQLserver
provider in web admin page to see whether the error also occur.

2. If occur, check the IIS virtual dir''s "directory security" setting to
see whether allow anonymous access is checked, if so uncheck it (make sure
integrated windows ) is used. Then, restart web admin page and retry.

3. Creating a new web application through File System to see whether we can
correctly test the ASPSqlProvider

#When perfom the above tests, don''t add any custom configuration in
web.config since there have default confifured providers for membership or
other services in machine level config.

Hope helps. Thanks,

Steven Cheng
Microsoft Online Support

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


这篇关于如何启用Web服务器来创建数据库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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