473,405 Members | 2,421 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

How do I enable the web server to create a database?

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?
Nov 19 '05 #1
10 3766
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.)

Nov 19 '05 #2
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.
Nov 19 '05 #3
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.)

Nov 19 '05 #4
Thank you for your suggestions, but I was still unable to create the database.

Here is what I did:
1. Using Visual Studio 2005 Beta 2, I created an ASP.NET Web Site through
HTTP. I then selected ASP.NET Configuration from the Website menu, and
tested the AspNetSqlProvider. I received the same error as before.

2. In IIS, I unchecked anonymous access in the virtual directory's
directory security and made sure that Integrated Windows authentication was
checked. I retested, but received the same error.

3. Using Visual Studio 2005 Beta 2, I created another ASP.NET Web Site
through the File System, but the AspNetSqlProvider failed as before.

Nov 19 '05 #5
Although I have still had no success creating the database, here is what I
have tried over the weekend:

I tried some new connection strings in web.config. Here is the updated
file, showing everything I tried:
<?xml version="1.0"?>
<configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
<connectionStrings>
<add name="SqlServices"
connectionString="Provider=SQLOLEDB;Integrated Security=SSPI;Data
Source=VSDEV01SSQL02;Initial Catalog=WebPortal;" />
<add name="SqlServicesOLEDB"
connectionString="Provider=SQLOLEDB;UID=developer; PWD=secret;Data
Source=VSDEV01SSQL02;Initial Catalog=WebPortal;" />
<add name="SqlServicesODBC"
connectionString="DSN=WebPortal;Initial
Catalog=WebPortal;UID=developer;PWD=secret;" />
</connectionStrings>
<system.web>
<membership userIsOnlineTimeWindow="60">
<providers>
<add
name="AspNetSqlProvider"
type="System.Web.Security.SqlMembershipProvider"
connectionStringName="SqlServices"
applicationName="/WebPortal"
requiresUniqueEmail="false"
enablePasswordRetrieval="false"
enablePasswordReset="true"
requiresQuestionAndAnswer="true"
passwordFormat="Hashed"
description="Web Portal"
/>
</providers>
</membership>

Also, I have discovered a very quick way to generate a more specific error
message that seems to be related to this problem:
1. From Visual Studio's Website menu, select ASP.NET Configuration.
2. Select the Security tab.
3. The following message appears:
"There is a problem with your selected data store. This can be caused by an
invalid server name or credentials, or by insufficient permission. It can
also be caused by the role manager feature not being enabled. Click the
button below to be redirected to a page where you can choose a new data
store.

The following message may help in diagnosing the problem: 'Unable to connect
to SQL Server database.'"

I have verified that the server name and credentials are correct by
connecting to the database from another workstation with Enterprise Manager.
I am logged in as a domain administrator, and the "developer" login that I
tried using SQL Server Authentication is a member of every role in the
database, including the aspnet roles. I am not using the ASP.NET 2.0 roles,
so I did not enable the "role manager feature," and I do not even know how to
do that.
Nov 19 '05 #6
Thanks for the further followup.

Really very strange.
As for enable the RoleManager you can just put the
<roleManager enabled="true" />
in your web.config though I remember that there is a certain check option
in the web admin page.

In addition, I didn't put any explicit declaration of the providers in my
web.config, I used the default configured in the machine.config. So My
web.config is like below:

===============================
......
<system.web>
<authorization>
<allow roles="admins" />
<allow users="?" />
</authorization>
<roleManager enabled="true" />
<authentication mode="Forms" />
</system.web>
..............
===============================

Then, I'm able to create the ASPNETDB.MDF file under App_Data folder. Have
you also tried this?

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.)

Nov 19 '05 #7
Although you did not directly solve my problem, today I was able to solve it
by studying the machine.config file that you mentioned (I did not even know
it existed before today).

Here is what I did. First, I commented out the "LocalSqlServer" connection
string in machine.config:
<connectionStrings>
<!-- <add name="LocalSqlServer" connectionString="data
source=.\SQLEXPRESS;Integrated
Security=SSPI;AttachDBFilename=|DataDirectory|aspn etdb.mdf;User
Instance=true" providerName="System.Data.SqlClient" /> -->
</connectionStrings>

Second, I replaced it in web.config and added the new provider:
<?xml version="1.0" encoding="utf-8"?>
<configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
<connectionStrings>
<!-- The following line replaces the equivalent line in
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50215\CONF IG\machine.config,
which has been commented out. Technically, VSDev01SSQL02 is not a local
SQL Server, but it works, as opposed to SQL Express, which does not. -->
<add name="LocalSqlServer"
connectionString="Integrated Security=SSPI;Data
Source=VSDev01SSQL02;Initial Catalog=WebPortal;"
providerName="System.Data.SqlClient" />
<!-- This is an identical connection string, but given a new name
to emphasize that it will always be on a separate machine that
contains the application data. -->
<add name="SqlServices"
connectionString="Integrated Security=SSPI;Data
Source=VSDev01SSQL02;Initial Catalog=WebPortal;"
providerName="System.Data.SqlClient" />
</connectionStrings>
<system.web>
<membership
defaultProvider="SqlProvider"
userIsOnlineTimeWindow="60">
<providers>
<add connectionStringName="SqlServices" applicationName="/visual studio
2005"
requiresUniqueEmail="false" enablePasswordRetrieval="false"
enablePasswordReset="true" requiresQuestionAndAnswer="true"
passwordFormat="Hashed" description="Web Portal" name="SqlProvider"
type="System.Web.Security.SqlMembershipProvider" />
</providers>
</membership>

Please note that one of the primary issues was that I was previously using
SQLOLEDB as my provider in the connection string, and that is what caused the
connection to fail. When I switched to the format in machine.config, as
shown above, I was able to connect to the database.

Thank you for your help.
Nov 19 '05 #8
Thanks for your followup.

I'm also very glad that you've overcome the problem.
Enjoy Whidbey ! :-)

Steven Cheng
Microsoft Online Support

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

Nov 19 '05 #9

I'm having the same problem getting SQLExpress to auto create m
database. I've been able to get the database created automatically o
several occations through the 2005 web admin site, but it seems to hav
just stopped working.

I get the following error:
Could not establish a connection to the database.
If you have not yet created the SQL Server database, exit the Web Sit
Administration tool, use the aspnet_regsql command-line utility t
create and configure the database, and then return to this tool to se
the provider.

The Event Viewer has the following error:

Failed to generate a user instance of SQL Server due to a failure i
starting the process for the user instance. The connection will b
closed. [CLIENT: <local machine>]
I have default machine.config and web.config files, so I have change
nothing from the default installation of VS2005 Beta. In fact,
uninstalled everything and reinstalled everything and still have th
problem. Please help.

Derek Greer
FedEx Corporate Service

--
derekgree
-----------------------------------------------------------------------
derekgreer's Profile: http://www.highdots.com/forums/member.php?userid=25
View this thread: http://www.highdots.com/forums/showthread.php?t=76717

Nov 19 '05 #10

just configure the developer's rights of the computer,that's ok !
*** Sent via Developersdex http://www.developersdex.com ***
Nov 19 '05 #11

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: simpsoro | last post by:
How do you enable debugging so that people see it from the client side? I have gone in to properties, clicked on edit www service, clicked on the home directory tab, clicked on the configuration...
0
by: CR | last post by:
To check out stored procs that are under VSS control via my client machine using .NET, I believe I need to change the Options - Database Tools - Server Explorer - STored Procedures - Enable Version...
1
by: stevenkblack | last post by:
I want to have a script that checks that my databases are up and running. I just want the scrip to connect to several databases and check the count of a certain table. I want this script to run...
6
by: Stu Carter | last post by:
Hi, I have an aspx page where some controls are initially disabled by the code-behind 'Page_Load' event. I want these controls to be dynamically enabled when the user checks a checkbox. ...
1
by: simpsoro | last post by:
How do you enable debugging so that people see it from the client side? I have gone in to properties, clicked on edit www service, clicked on the home directory tab, clicked on the configuration...
3
by: James | last post by:
Hello, I am having a problem with a MS Access 2000 Database that I partially helped create. I am recording visits that registered customers make to our store. I have a list of all the elidgible...
1
by: danyeungw | last post by:
I get the following from the link http://support.microsoft.com/kb/314206. I need to have both work - the page stays where it is and set focus to next control. Does anyone have solution? I have...
10
by: =?Utf-8?B?UHVuaXQgS2F1cg==?= | last post by:
Hi, I am developing a windows application in VS.NET 2005. The application is database driven and I need to deploy it on a client's pc. How should I go about developing such an application. I...
3
by: Pietro | last post by:
Hi all, First of all I'd like to thank you very very much ,as finally after many years of searching,I could find a code to disable/enable the shift key,but actually i cannot use the code as I'm...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.