By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
428,829 Members | 1,829 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 428,829 IT Pros & Developers. It's quick & easy.

No db access after publishing web site

P: n/a
I developed my first web site using Visual studio 2005.
It works very well with Visual Studio. But after I published the web site in
a file system folder in my PC using
the instructions I found in Visual studio help Walkthrough: Publishing a Web
Site, I can navigate the web forms
except the ones with connections (using Gridview, details view) to the
database (SQL Server 2005).

What didn't I do?

Thank you

Agos

Jun 8 '07 #1
Share this Question
Share on Google+
7 Replies


P: n/a
Sounds like your connection string needs to be different
at the server where you published your application to.

Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
======================================
"Agos" <ag**************@fastwebnet.itwrote in message
news:6C******************@tornado.fastwebnet.it...
>I developed my first web site using Visual studio 2005.
It works very well with Visual Studio. But after I published the web site in a file system folder
in my PC using
the instructions I found in Visual studio help Walkthrough: Publishing a Web Site, I can navigate
the web forms
except the ones with connections (using Gridview, details view) to the database (SQL Server 2005).

What didn't I do?

Thank you

Agos

Jun 8 '07 #2

P: n/a
I published my application in the same file system (different folder) on
same PC.
This is the connection string I use
<add name="pagoConnectionString" connectionString="Data
Source=.\SQLEXPRESS;Initial Catalog=pago;Integrated Security=True;User
Instance=False"
The database is in folder
C:\Programmi\Microsoft SQL Server\MSSQL.1\MSSQL\Data
My working solution is in D:\WEB\WASP
I published in C:\WEB\WASP
and it also works except than the db WEB forms with gridview
"Juan T. Llibre" <no***********@nowhere.comha scritto nel messaggio
news:%2******************@TK2MSFTNGP02.phx.gbl...
Sounds like your connection string needs to be different
at the server where you published your application to.

Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
======================================
"Agos" <ag**************@fastwebnet.itwrote in message
news:6C******************@tornado.fastwebnet.it...
>>I developed my first web site using Visual studio 2005.
It works very well with Visual Studio. But after I published the web site
in a file system folder in my PC using
the instructions I found in Visual studio help Walkthrough: Publishing a
Web Site, I can navigate the web forms
except the ones with connections (using Gridview, details view) to the
database (SQL Server 2005).

What didn't I do?

Thank you

Agos


Jun 8 '07 #3

P: n/a
1. Is the SQL Server Express database in the new application's App_Data folder ?

2. Are you detaching/attaching the SQL Server Express database correctly ?


Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
======================================
"Agos" <ag**************@fastwebnet.itwrote in message
news:Ox*******************@tornado.fastwebnet.it.. .
>I published my application in the same file system (different folder) on same PC.
This is the connection string I use
<add name="pagoConnectionString" connectionString="Data Source=.\SQLEXPRESS;Initial
Catalog=pago;Integrated Security=True;User Instance=False"
The database is in folder
C:\Programmi\Microsoft SQL Server\MSSQL.1\MSSQL\Data
My working solution is in D:\WEB\WASP
I published in C:\WEB\WASP
and it also works except than the db WEB forms with gridview
"Juan T. Llibre" <no***********@nowhere.comha scritto nel messaggio
news:%2******************@TK2MSFTNGP02.phx.gbl...
>Sounds like your connection string needs to be different
at the server where you published your application to.

Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
======================================
"Agos" <ag**************@fastwebnet.itwrote in message
news:6C******************@tornado.fastwebnet.it.. .
>>>I developed my first web site using Visual studio 2005.
It works very well with Visual Studio. But after I published the web site in a file system
folder in my PC using
the instructions I found in Visual studio help Walkthrough: Publishing a Web Site, I can
navigate the web forms
except the ones with connections (using Gridview, details view) to the database (SQL Server
2005).

What didn't I do?

Thank you

Agos



Jun 8 '07 #4

P: n/a

1. Is the SQL Server Express database in the new application's App_Data
folder ?
================================================== =========
No it is in C:\Programmi\Microsoft SQL Server\MSSQL.1\MSSQL\Data
In there is only App_Data folder ASPNETDB.MDF

2. Are you detaching/attaching the SQL Server Express database correctly ?
================================================== =========
I never detach it since both point to C:\Programmi\Microsoft SQL
Server\MSSQL.1\MSSQL\Data
since both use the same connectionString
>

Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
======================================
"Agos" <ag**************@fastwebnet.itwrote in message
news:Ox*******************@tornado.fastwebnet.it.. .
>>I published my application in the same file system (different folder) on
same PC.
This is the connection string I use
<add name="pagoConnectionString" connectionString="Data
Source=.\SQLEXPRESS;Initial Catalog=pago;Integrated Security=True;User
Instance=False"
The database is in folder
C:\Programmi\Microsoft SQL Server\MSSQL.1\MSSQL\Data
My working solution is in D:\WEB\WASP
I published in C:\WEB\WASP
and it also works except than the db WEB forms with gridview
"Juan T. Llibre" <no***********@nowhere.comha scritto nel messaggio
news:%2******************@TK2MSFTNGP02.phx.gbl. ..
>>Sounds like your connection string needs to be different
at the server where you published your application to.

Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
======================================
"Agos" <ag**************@fastwebnet.itwrote in message
news:6C******************@tornado.fastwebnet.it. ..
I developed my first web site using Visual studio 2005.
It works very well with Visual Studio. But after I published the web
site in a file system folder in my PC using
the instructions I found in Visual studio help Walkthrough: Publishing
a Web Site, I can navigate the web forms
except the ones with connections (using Gridview, details view) to the
database (SQL Server 2005).

What didn't I do?

Thank you

Agos




Jun 8 '07 #5

P: n/a
I found the error.
Cannot open database "pago" requested by the login. The login failed. Login
failed for user 'XQ4\ASPNET'.
Now I have to find how to solve this :-)
Any help?

Thank you

Agos

"Juan T. Llibre" <no***********@nowhere.comha scritto nel messaggio
news:%2****************@TK2MSFTNGP04.phx.gbl...
1. Is the SQL Server Express database in the new application's App_Data
folder ?

2. Are you detaching/attaching the SQL Server Express database correctly ?


Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
======================================
"Agos" <ag**************@fastwebnet.itwrote in message
news:Ox*******************@tornado.fastwebnet.it.. .
>>I published my application in the same file system (different folder) on
same PC.
This is the connection string I use
<add name="pagoConnectionString" connectionString="Data
Source=.\SQLEXPRESS;Initial Catalog=pago;Integrated Security=True;User
Instance=False"
The database is in folder
C:\Programmi\Microsoft SQL Server\MSSQL.1\MSSQL\Data
My working solution is in D:\WEB\WASP
I published in C:\WEB\WASP
and it also works except than the db WEB forms with gridview
"Juan T. Llibre" <no***********@nowhere.comha scritto nel messaggio
news:%2******************@TK2MSFTNGP02.phx.gbl. ..
>>Sounds like your connection string needs to be different
at the server where you published your application to.

Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
======================================
"Agos" <ag**************@fastwebnet.itwrote in message
news:6C******************@tornado.fastwebnet.it. ..
I developed my first web site using Visual studio 2005.
It works very well with Visual Studio. But after I published the web
site in a file system folder in my PC using
the instructions I found in Visual studio help Walkthrough: Publishing
a Web Site, I can navigate the web forms
except the ones with connections (using Gridview, details view) to the
database (SQL Server 2005).

What didn't I do?

Thank you

Agos




Jun 9 '07 #6

P: n/a
re:
!Cannot open database "pago" requested by the login. The login failed. Login
!failed for user 'XQ4\ASPNET'.
!It works very well with Visual Studio. But after I published the web
!site in a file system folder in my PC using

When you run any app using the Visual Studio Development Server, ASP.NET runs as
MachineName\WindowsLoggedInAccount, in your case, I'll venture that you're running
as Administrator, which would make the account XQ4\Administrator.

When you run any app using IIS, ASP.NET runs as the default account.
In your case, that's XQ4\ASPNET.

When you run the app in the VS internal web server, your login succeeds.

When you run the app in IIS, your login fails...because ASP.NET runs as
a different account...and you're using integrated security in your connection string.

So, your Windows Logged-In Account has permissions to the database, but XQ4\ASPNET doesn't.

Either grant XQ4\ASPNET access permissions to the database, or
change the authentication method for your connection to "mixed"
( instead of Windows only )...and use an ad-hoc SQL login account
to access your database ( that means changing your connection string ).


Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
======================================
"Agos" <ag**************@fastwebnet.itwrote in message
news:Bs******************@tornado.fastwebnet.it...
>I found the error.
Cannot open database "pago" requested by the login. The login failed. Login failed for user
'XQ4\ASPNET'.
Now I have to find how to solve this :-)
Any help?

Thank you

Agos

"Juan T. Llibre" <no***********@nowhere.comha scritto nel messaggio
news:%2****************@TK2MSFTNGP04.phx.gbl...
>1. Is the SQL Server Express database in the new application's App_Data folder ?

2. Are you detaching/attaching the SQL Server Express database correctly ?
>Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
======================================
"Agos" <ag**************@fastwebnet.itwrote in message
news:Ox*******************@tornado.fastwebnet.it. ..
>>>I published my application in the same file system (different folder) on same PC.
This is the connection string I use
<add name="pagoConnectionString" connectionString="Data Source=.\SQLEXPRESS;Initial
Catalog=pago;Integrated Security=True;User Instance=False"
The database is in folder
C:\Programmi\Microsoft SQL Server\MSSQL.1\MSSQL\Data
My working solution is in D:\WEB\WASP
I published in C:\WEB\WASP
and it also works except than the db WEB forms with gridview
"Juan T. Llibre" <no***********@nowhere.comha scritto nel messaggio
news:%2******************@TK2MSFTNGP02.phx.gbl.. .
Sounds like your connection string needs to be different
at the server where you published your application to.

Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
======================================
"Agos" <ag**************@fastwebnet.itwrote in message
news:6C******************@tornado.fastwebnet.it ...
>I developed my first web site using Visual studio 2005.
It works very well with Visual Studio. But after I published the web site in a file system
folder in my PC using
the instructions I found in Visual studio help Walkthrough: Publishing a Web Site, I can
navigate the web forms
except the ones with connections (using Gridview, details view) to the database (SQL Server
2005).
>
What didn't I do?
>
Thank you
>
Agos

Jun 9 '07 #7

P: n/a
Thank you Juan,
after lots of try it seems I succseded!
here's what I did using the graphical tool of Sql server 2005:
USE [pago]
GO
CREATE USER [ASPNET] FOR LOGIN [XQ4\ASPNET]
GO

GRANT UPDATE TO [ASPNET]
GRANT SELECT TO [ASPNET]
GRANT INSERT TO [ASPNET]
GRANT EXECUTE TO [ASPNET]
GRANT CONNECT TO [ASPNET]

Maybe I could do better or in another way or maybe I did too much ......
Now this was just a try on my PC.
If I detach and attach this database on a different PC (according that PC
has the same name XP4) can I and my collegues from their own PC connect to
this WEB in an intranet environment?

Thank you

Agos

"Juan T. Llibre" <no***********@nowhere.comha scritto nel messaggio
news:uO**************@TK2MSFTNGP03.phx.gbl...
re:
!Cannot open database "pago" requested by the login. The login failed.
Login
!failed for user 'XQ4\ASPNET'.
!It works very well with Visual Studio. But after I published the web
!site in a file system folder in my PC using

When you run any app using the Visual Studio Development Server, ASP.NET
runs as
MachineName\WindowsLoggedInAccount, in your case, I'll venture that you're
running
as Administrator, which would make the account XQ4\Administrator.

When you run any app using IIS, ASP.NET runs as the default account.
In your case, that's XQ4\ASPNET.

When you run the app in the VS internal web server, your login succeeds.

When you run the app in IIS, your login fails...because ASP.NET runs as
a different account...and you're using integrated security in your
connection string.

So, your Windows Logged-In Account has permissions to the database, but
XQ4\ASPNET doesn't.

Either grant XQ4\ASPNET access permissions to the database, or
change the authentication method for your connection to "mixed"
( instead of Windows only )...and use an ad-hoc SQL login account
to access your database ( that means changing your connection string ).


Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
======================================
"Agos" <ag**************@fastwebnet.itwrote in message
news:Bs******************@tornado.fastwebnet.it...
>>I found the error.
Cannot open database "pago" requested by the login. The login failed.
Login failed for user 'XQ4\ASPNET'.
Now I have to find how to solve this :-)
Any help?

Thank you

Agos

"Juan T. Llibre" <no***********@nowhere.comha scritto nel messaggio
news:%2****************@TK2MSFTNGP04.phx.gbl...
>>1. Is the SQL Server Express database in the new application's App_Data
folder ?

2. Are you detaching/attaching the SQL Server Express database correctly
?

>>Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
======================================
"Agos" <ag**************@fastwebnet.itwrote in message
news:Ox*******************@tornado.fastwebnet.it ...
I published my application in the same file system (different folder) on
same PC.
This is the connection string I use
<add name="pagoConnectionString" connectionString="Data
Source=.\SQLEXPRESS;Initial Catalog=pago;Integrated Security=True;User
Instance=False"
The database is in folder
C:\Programmi\Microsoft SQL Server\MSSQL.1\MSSQL\Data
My working solution is in D:\WEB\WASP
I published in C:\WEB\WASP
and it also works except than the db WEB forms with gridview
"Juan T. Llibre" <no***********@nowhere.comha scritto nel messaggio
news:%2******************@TK2MSFTNGP02.phx.gbl. ..
Sounds like your connection string needs to be different
at the server where you published your application to.
>
>
>
Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
======================================
"Agos" <ag**************@fastwebnet.itwrote in message
news:6C******************@tornado.fastwebnet.i t...
>>I developed my first web site using Visual studio 2005.
>It works very well with Visual Studio. But after I published the web
>site in a file system folder in my PC using
>the instructions I found in Visual studio help Walkthrough:
>Publishing a Web Site, I can navigate the web forms
>except the ones with connections (using Gridview, details view) to
>the database (SQL Server 2005).
>>
>What didn't I do?
>>
>Thank you
>>
>Agos


Jun 9 '07 #8

This discussion thread is closed

Replies have been disabled for this discussion.