Wrox Programmer Forums
|
BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3
This is the forum to discuss the Wrox book Beginning ASP.NET 3.5: In C# and VB by Imar Spaanjaars; ISBN: 9780470187593
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 13th, 2009, 06:50 PM
Authorized User
 
Join Date: Jan 2009
Posts: 21
Thanks: 5
Thanked 0 Times in 0 Posts
Default Chapter 18 - Viewing aspx page in IIS

Hi,

I've wasted too many hours trying to find out why this happens. But now I admit that I need help:)

Description of problem:
OS: Vista home Premium
SQL Server 2008 express
VWD 2008 Express

I have followed the descriptions in the book, with just a few exceptions:

I created a new website in IIS which is accessed using this address: http://localhost:81/
For some, perhaps stupid, reason I wanted to separate Planet Wrox from my default site on the default port...
After completing the steps on page 656, I was actually able to view the default.aspx page. But got some errors when trying to log in.

I de-activated customErrors, to present the Yellow Screen of Death.
This is what happens:


Server Error in '/' Application.

User does not have permission to perform this action.

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.

Exception Details: System.Data.SqlClient.SqlException: User does not have permission to perform this action.

Source Error:

Line 46: public virtual string FavoriteTheme {Line 47: get {Line 48: return ((string)(this.GetPropertyValue("FavoriteTheme"))) ;Line 49: }Line 50: set {

Stack Trace:

[SqlException (0x80131904): User does not have permission to perform this action.] System.Data.ProviderBase.DbConnectionPool.GetConne ction(DbConnection owningObject) +428 System.Data.ProviderBase.DbConnectionFactory.GetCo nnection(DbConnection owningConnection) +65 System.Data.ProviderBase.DbConnectionClosed.OpenCo nnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) +117 System.Data.SqlClient.SqlConnection.Open() +122 System.Web.DataAccess.SqlConnectionHolder.Open(Htt pContext context, Boolean revertImpersonate) +87 System.Web.DataAccess.SqlConnectionHelper.GetConne ction(String connectionString, Boolean revertImpersonation) +221 System.Web.Profile.SqlProfileProvider.GetPropertyV aluesFromDatabase(String userName, SettingsPropertyValueCollection svc) +772 System.Web.Profile.SqlProfileProvider.GetPropertyV alues(SettingsContext sc, SettingsPropertyCollection properties) +433 System.Configuration.SettingsBase.GetPropertiesFro mProvider(SettingsProvider provider) +258 System.Configuration.SettingsBase.GetPropertyValue ByName(String propertyName) +132 System.Configuration.SettingsBase.get_Item(String propertyName) +102 System.Web.Profile.ProfileBase.GetInternal(String propertyName) +36 System.Web.Profile.ProfileBase.get_Item(String propertyName) +68 System.Web.Profile.ProfileBase.GetPropertyValue(St ring propertyName) +7 ProfileCommon.get_FavoriteTheme() in c:\Windows\Microsoft.NET\Framework\v2.0.50727\Temp orary ASP.NET Files\root\a8c2d88e\b1a08332\App_Code.7ejekess.7.c s:48 BasePage.Page_PreInit(Object sender, EventArgs e) in c:\BegAspNet\Release\App_Code\BasePage.cs:10 System.Web.UI.Page.OnPreInit(EventArgs e) +8699406 System.Web.UI.Page.PerformPreInit() +31 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +282

My connection strings in web.config:
<addname="PlanetWroxConnectionString"connectionString="Data Source=.\SQLEXPRESS; Integrated Security=SSPI; AttachDbFilename=|DataDirectory|PlanetWrox.mdf; User instance=True"
providerName="System.Data.SqlClient" />
<
addname="LocalSqlServer"connectionString="Data Source=.\SQLEXPRESS; Integrated Security=SSPI; AttachDBFilename=|DataDirectory|aspnetdb.mdf; User Instance=True"
providerName="System.Data.SqlClient" />


I have a feeling I should be smart enough to figure this out myself, but any help is highly appreciated! :)

One last thing: The site works perfectly well when running from VWD.
 
Old August 14th, 2009, 05:02 AM
Authorized User
 
Join Date: Jan 2009
Posts: 21
Thanks: 5
Thanked 0 Times in 0 Posts
Default

Hi again folks!

I think I might have found the solution to my own problem.
When I first started to configure IIS on my local computer yesterday, I noticed that "Test setttings" failed for my PlanetWrox web site.
(Basic Settings for web site -> Test Settings...)

When clicking the "Connect As..."-button, I noticed that "Application User(pass-through Authentication" was selected.I changed that to "Specific user", and added my own Windows account. Now test settings worked fine.
But I got these errors when trying to access my web site on IIS.

Just now I changed it back to "Application user (Pass-through...", and now test settings actually works with this setting. And my web site is fully accessible!

But I am never happy until I understand why things suddenly work. I suspect that editing security permissions for the directories, as specified on the Try It Out starting on page 653, did the trick.
This is only one possible theory, since I don't have a complete overview of all the "clever" solutions I have tried back and forth...

What user account is used when specifying "Application User(pass-through Authentication" in the "Connect as..." dialogue?
I suspect that there is a black hole in my knowledge in fundamental IIS configuration...
 
Old August 14th, 2009, 05:13 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi havardoj,

In the Connect As dialog box click the Help icon to bring up the help page. You'll get a help page with details for the feature which includes the text:
Quote:
Use the Connect As dialog box to select the method that IIS uses to access content from the physical path that was specified for the site, application, or virtual directory. The physical path can be a path to a directory on the local computer or to a directory or share on a remote computer.
So, basically you specify which account is used to access physical resources on disk.

If you don't specify a user, the default account used by IIS is Network Service. This account needs read access (and write access to App_Data) in order to work with the site.

Your own account probably already has that permission, so when you specify your own account, things probably work without further modification. However, once you select pass-through then Network Service needs to be configured as well.

Hope this clarifies things a bit.

>>But I am never happy until I understand why things suddenly work.

In that case, take a look at Professional IIS

Cheers,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
 
Old August 14th, 2009, 07:10 AM
Authorized User
 
Join Date: Jan 2009
Posts: 21
Thanks: 5
Thanked 0 Times in 0 Posts
Default

Hi Imar,

Thanks for replying!

Quote:
Originally Posted by Imar View Post
In the Connect As dialog box click the Help icon to bring up the help page. You'll get a help page with details for the feature which includes the text..
I sometimes have a tendency to forget to look for help files, and ask an expert instead. Thanks for reminding me!

Quote:
Originally Posted by Imar View Post
If you don't specify a user, the default account used by IIS is Network Service. This account needs read access (and write access to App_Data) in order to work with the site.
My only problem now, is that I actually have to use my own windows account for the PlanetWrox Application pool, even if Network Service actually seems to have necessary permissions for the app_data folde.

Quote:
Originally Posted by Imar View Post
Hope this clarifies things a bit.
It did! And I will check out the book you mentioned.

By the way, I can't find the Database publishing wizard that is mentioned in Step 1. on page 658. Is that only available in the commercial versions of VWD?


..HÃ¥vard..
 
Old August 14th, 2009, 09:56 AM
Authorized User
 
Join Date: Jan 2009
Posts: 21
Thanks: 5
Thanked 0 Times in 0 Posts
Default

I just wanted to let you know that I solved the last remaining problems, after doing something completely different for a while

I followed the guidelines in appendix B, to attach the databases and configure them to use Windows Authentication(Since everything is running om my local PC). Then I had a "Eureka-moment", and the application pool is now running fine with the Network Service account!

Imar: It's been easy to learn ASP.Net using your book, very great work!
 
Old August 17th, 2009, 02:41 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Excellent; glad it's all working now, and good to hear you like the book so much....

Cheers,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
 
Old August 17th, 2009, 02:49 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

BTW: did you find the Database publishing wizard? I wrote and tested the book against VWD Express so it should be there....

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
 
Old August 17th, 2009, 04:03 AM
Authorized User
 
Join Date: Jan 2009
Posts: 21
Thanks: 5
Thanked 0 Times in 0 Posts
Default

Hi again,

Hmmm... I tried looking through the help files, and it seems that SQL Server 2008 Express is not a supported platform: http://msdn.microsoft.com/en-us/library/bb895179.aspx
I can't find the option when right clicking the database inside VWD.
Using 2005 Express or the Commercial version of 2008 should work, though.

So this seems to be my fault, by installing an un-supported version of SQL Server. BTW, I haven't verified this by installing 2005 Express.
I guess that I could create a script inside SQL Server Management studio to export the database if I want to?
 
Old August 17th, 2009, 08:23 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Maye you're right-clicking the database in the Solution Explorer instead of in the Server Explorer / Database Explorer?

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
 
Old August 17th, 2009, 04:19 PM
Authorized User
 
Join Date: Jan 2009
Posts: 21
Thanks: 5
Thanked 0 Times in 0 Posts
Default

No, I'm actually right clicking in the database explorer.
If you're sure this should work with SQL Server 2008 Express, Then I have obviously done something wrong.
Could it be there's a package/functionality of SQL Server that I have missed to install?





Similar Threads
Thread Thread Starter Forum Replies Last Post
Chapter 8 style.aspx page stoverje BOOK: Professional ASP.NET 2.0 Design: CSS, Themes, and Master Pages ISBN: 978-0-470-12448-2 4 December 28th, 2010 04:22 AM
Try it Out Chapter 18 Page 587 Step 4 workib BOOK: Beginning Microsoft Visual C# 2008 ISBN: 978-0-470-19135-4 0 November 6th, 2008 02:01 PM
Viewing ASP files in IIS 3.0 otixz ASP.NET 1.0 and 1.1 Basics 1 October 29th, 2004 02:30 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.