Accessing SqlServer(Express) data on the server

D

David Thielen

5. Are there instructions anywhere on exactly what I need to do (Config
settings, file ACLs, sql scripts run, etc) to install & configure my app and
SqlServerExpress so it is all working on IIS – both on Windows 2000 and
Windows 2003.

a. Can I assume it will have the right connectionstring in machine.config or
does that sometimes get changed? This will usually be going on a Windows 2003
server that does not have any dev tools installed on it.

b. Should I use a different connectionstring so I don’t hit the issue of noe
being able to connect if accessed via a user other than NETWORK SERVICE? And
if so, what should the connection string be – when SSE is always on the same
machine as IIS and the mdf file?

c. Same for roleManager/providers – can I assume AspNetSqlRoleProvider and
AspNetWindowsTokenRoleProvider will be there?

d. Do I need to do anything to make sure ASPNET or whatever user IIS is
using to access the database has rights to the database?

e. What permissions for what users do I need to grant to the App_Data
directory and all files in it?

6. Same question when using Sql Server instead of Express.
 
S

Steven Cheng[MSFT]

Hi Dave,

As for the ASP.NET , it is built upon the .net framework, so generally all
the .net specific settings should be common among most windows platform. We
do not need to do much on this since .net framework has encapsulated and
abstract this for us.

For your decent questions, here are my understanding inline:

a. Can I assume it will have the right connectionstring in machine.config
or
does that sometimes get changed? This will usually be going on a Windows
2003
server that does not have any dev tools installed on it.
==============================
If all the servers performed the default installation (.net framework 2.0),
you should find the same default configuration for the membership/role
proviers in machine.config(use Sqlsever provider) and the default
connectionstring are all point to a sqlexpress mdf file in the
application's App_Data folder.

b. Should I use a different connectionstring so I don’t hit the issue of
noe
being able to connect if accessed via a user other than NETWORK SERVICE?
And
if so, what should the connection string be �when SSE is always on the
same
machine as IIS and the mdf file?
==============================
Of course, you can change the connectionstring to point to another
database(instead of a sqlexpress mdf file). You can point to a SQL Server
intance's database. e.g.

the default connectionstring is

<add name="LocalSqlServer" connectionString="data
source=.\SQLEXPRESS;Integrated
Security=SSPI;AttachDBFilename=|DataDirectory|aspnetdb.mdf;User
Instance=true" providerName="System.Data.SqlClient" />

which use "attachDB" and "User Instance" mode which means the SQL Express
engine will dynamically create a db instance and attach this mdf file at
runtime(rather than preinstall it in SQL Express service instance). You can
manually create another database (named "MyASPNETDB" in SQL Express
instance) and connect is through the following connectionstring:

<add name="MyASPNETDBConnectionString" connectionString="Data
Source=localhost\sqlexpress;Initial Catalog=MyASPNETDB;Integrated
Security=True"
providerName="System.Data.SqlClient" />

Also, you can even use SQL Server authentication(specify username/password
in connectionstring) instead of using windows authentication.



c. Same for roleManager/providers �can I assume AspNetSqlRoleProvider and
AspNetWindowsTokenRoleProvider will be there?
===============================
Of course they'll exist on any machine which have .net framework 2.0
installed since they're all built-in providers.(And SqlRoleProvider is the
default one).


d. Do I need to do anything to make sure ASPNET or whatever user IIS is
using to access the database has rights to the database?
================================
If you're using the default connectionstring (connect a local mdf database
in App_Data dir), that should be ok. If you're connecting to an existing
database in SQL Server intance, you need to make sure the service
account(ASP.NET process account) or impersonated account has sufficient to
perfrom db query (if you're using windows authenitcation in the
connectionstring).


e. What permissions for what users do I need to grant to the App_Data
directory and all files in it?
==============================
As for the default connectionstring setting for local sqlexpress mdf
file(in app_data dir), we do not need to specify special permission. If
you're accessing a certain database in Server instance, you'll need to make
sure whether the current security context(asp.net process identity or
impersonated user) have sufficient permission to access the database(and
read or right permission depend on what operation we need to perform
against the database).


6. Same question when using Sql Server instead of Express.
==================================

I've mentioned the "Server instance" case in the above ones.

In addition, as for the difference between the default
connectionstring(which use a local dynamic attached mdf--- SQL EXPRESS )
or a preregistered database in SQL Server instance, you can ask for this in
SQL Server specific newsgroup or look up the "User Instance" or other
related key word in SQL Server Books Online for further understanding.

Hope this helps.

Regards,

Steven Cheng
Microsoft Online Community Support


==================================================

When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.

==================================================


This posting is provided "AS IS" with no warranties, and confers no rights.



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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,266
Messages
2,571,082
Members
48,773
Latest member
Kaybee

Latest Threads

Top