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 May 11th, 2009, 08:43 PM
Registered User
 
Join Date: Apr 2009
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Talking Chapter 18: Issues with the customErrors mode

Imar:
My local client has XP Pro. I move the site to IIS.
After I completed pages 652 thru 656, I ran the PlanetWrox website on my local host and got the following error Runtime error message pertaining to the <customerrors tag> on the web.config file (see at the bottom):
My present web config file was originally the following

<
authenticationmode="Forms"/>
<customErrorsmode="On"defaultRedirect="~/Errors/Error500.aspx">
<
errorstatusCode="404"redirect="~/Errors/Error404.aspx"/>
<
errorstatusCode="500"redirect="~/Errors/Error500.aspx"/>
</
customErrors>

Even when I change the mode to "RemoteOnly" or "OFF", I get the same error.
Any suggestions?
Thank you,
gfmann



Runtime Error

Description: An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed.

Details: To enable the details of this specific error message to be viewable on the local server machine, please create a <customErrors> tag within a "web.config" configuration file located in the root directory of the current web application. This <customErrors> tag should then have its "mode" attribute set to "RemoteOnly". To enable the details to be viewable on remote machines, please set "mode" to "Off".

<!-- Web.Config Configuration File --><configuration> <system.web> <customErrors mode="RemoteOnly"/> </system.web></configuration>
Notes: The current error page you are seeing can be replaced by a custom error page by modifying the "defaultRedirect" attribute of the application's <customErrors> configuration tag to point to a custom error page URL.

<!-- Web.Config Configuration File --><configuration> <system.web> <customErrors mode="On" defaultRedirect="mycustompage.htm"/> </system.web></configuration>
 
Old May 12th, 2009, 03:52 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 there,

You may also get this error when .NET is not able to properly display a page. The reason for this could be misconfiguration in IIS, the web.config itself or a security problem.

Does the Windows Event Log shed any light on this? Usually it logs the real error for the problem...

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 May 12th, 2009, 02:15 PM
Registered User
 
Join Date: Apr 2009
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default Chapter 18: Issues with customErrors mode

Imar:
Listed below is what I find in the Event Log. I am in the process of researching this and will get to you. Please wait on a response to give me a day or two to figure this out on my own.
I promise to get back to you.
Thanks for all you do,
gfmann

Here is my Event log:
Event Type: Warning
Event Source: ASP.NET 2.0.50727.0
Event Category: Web Event
Event ID: 1310
Date: 5/12/2009
Time: 10:36:55 AM
User: N/A
Computer: HOME-GAY
Description:
Event code: 3008
Event message: A configuration error has occurred.
Event time: 5/12/2009 10:36:55 AM
Event time (UTC): 5/12/2009 5:36:55 PM
Event ID: c04aa88c5ea14035beb835cdec250c00
Event sequence: 2
Event occurrence: 1
Event detail code: 0

Application information:
Application domain: /LM/W3SVC/1/ROOT-1-128866234145781250
Trust level: Full
Application Virtual Path: /
Application Path: c:\inetpub\wwwroot\
Machine name: HOME-GAY

Process information:
Process ID: 2668
Process name: aspnet_wp.exe
Account name: HOME-GAY\ASPNET

Exception information:
Exception type: ConfigurationErrorsException
Exception message: It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level. This error can be caused by a virtual directory not being configured as an application in IIS. (c:\inetpub\wwwroot\planetwrox\web.config line 44)

Request information:
Request URL: http://127.0.0.1/PlanetWrox/Default.aspx
Request path: /PlanetWrox/Default.aspx
User host address: 127.0.0.1
User:
Is authenticated: False
Authentication Type:
Thread account name: HOME-GAY\ASPNET

Thread information:
Thread ID: 1
Thread account name: HOME-GAY\ASPNET
Is impersonating: False
Stack trace: at System.Configuration.ConfigurationSchemaErrors.Thr owIfErrors(Boolean ignoreLocal)
at System.Configuration.BaseConfigurationRecord.GetSe ctionRecursive(String configKey, Boolean getLkg, Boolean checkPermission, Boolean getRuntimeObject, Boolean requestIsHere, Object& result, Object& resultRuntimeObject)
at System.Configuration.BaseConfigurationRecord.GetSe ction(String configKey, Boolean getLkg, Boolean checkPermission)
at System.Configuration.BaseConfigurationRecord.GetSe ction(String configKey)
at System.Web.Configuration.RuntimeConfig.GetSectionO bject(String sectionName)
at System.Web.Configuration.RuntimeConfig.GetSection( String sectionName, Type type, ResultsIndex index)
at System.Web.Configuration.RuntimeConfig.get_Identit y()
at System.Web.HttpContext.get_ImpersonationToken()
at System.Web.ClientImpersonationContext.Start(HttpCo ntext context, Boolean throwOnError)
at System.Web.HttpApplication.ThreadContext.SetImpers onationContext()
at System.Web.HttpApplication.ThreadContext.Enter(Boo lean setImpersonationContext)
at System.Web.HttpApplication.OnThreadEnterPrivate(Bo olean setImpersonationContext)
at System.Web.HttpApplication.ApplicationStepManager. ResumeSteps(Exception error)


Custom event details:

For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.
 
Old May 12th, 2009, 04:54 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

If you want a bit of a hint how to figure it out: take a look at page 656....

If you want more info or help, or a crystal clear explanation of the problem and how to fix it, please let me know.

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 May 13th, 2009, 04:00 PM
Registered User
 
Join Date: Apr 2009
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Red face Chapter 18: Issues with customErrors mode

Imar:
I'm ready for your help. Please explain.
v/r,
gfmann
 
Old May 13th, 2009, 04:31 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi gfmann,

(Have to hurry; have only a few minutes of juice left in my laptop.... ;-) )

Anyway, take a look at this:

Quote:
Exception message: It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level. This error can be caused by a virtual directory not being configured as an application in IIS. (c:\inetpub\wwwroot\planetwrox\web.config line 44)

Request information:
Request URL: http://127.0.0.1/PlanetWrox/Default.aspx
If you know what this means, it says it all. If you don't it's slightly difficult.

ASP.NET and IIS have the notion of "applications". An application is the starting point of many things: stuff like Session state, security and a whole bunch of other settings are scoped to an application. By default, the root of a site is an application. That is: http://localhost is an application. All normal folders under it share stuff with the root application.Virtual directories under this site (e.g. http://localhost/Somefolder) also share this information *unless* the virtual directory itself is marked as an application. In that case, a new application is created for that VD which doesn't share things with its parent.

Since some settings are application scoped, you can't redefine them in a sub folder which isn't an application. And that's exactly what the error message you got tells you: your web.config is located in a sub folder under the main root application, and tries to overwrite settings that it's not allowed to since the folder it resides in is no application in IIS.

The fix: it depends on how you want to configure it. XP only allows one site, so you either need to make http://localhost the root of Planet Wrox or you need to make the VD /PlanetWrox an application. I don't have XP here so I am roughly describing the steps from memory. You may need to do some searching for the right buttons or tabs ;-)

(I assume your site is located at c:\inetpub\wwwroot\planetwrox which is the main (site root) folder that contains Default.aspx, web.config, App_Themes and so on.)

A Run the site as a root.
  1. Open up IIS
  2. Right-click Default Web Site and choose Properties
  3. Make sure that there's a Remove button for the Application (which is named something like Default Web Site)
  4. Go to the Home Directory tab and ensure (or change) the path is set to c:\inetpub\wwwroot\planetwrox
  5. Apply all changes and browse to http://localhost
B Run the site as a Virtual Directory under localhost
  1. Open up IIS.
  2. Delete any prior virtual directories (recognizable by their icons with globes on them)
  3. Right-click the site and choose New Virtual Directory
  4. Follow the wizard, name the VD PlanetWrox, point to c:\inetpub\wwwroot\planetwrox\ as the folder and make sure Execute rights are on.
  5. Back in the site settings, check that there's a Remove button on the tab about the application. (Remove indicates the folder is a VD, clicking Remove removes the application again and changes the applicatiion to a normal VD; don't do this now). Also, make sure Scripts is selected in the permissions drop-down.
  6. Apply all changes
  7. Browse to http://localhost/PlanetWrox
That should do the trick.

Hope this helps; if not, can you let me know which scenario you're using and what the steps are that you're following?

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!





Similar Threads
Thread Thread Starter Forum Replies Last Post
customErrors Maxxim BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 3 February 5th, 2008 08:41 PM
Chapter 18 re: VSS kevinstruckhoff BOOK: Professional SQL Server 2005 Integration Services ISBN: 0-7645-8435-9 0 August 8th, 2006 11:04 AM
Chapter 18 - Struts rollopa JSP Basics 0 September 14th, 2003 03:23 PM





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