Re: VS.NET 2005 and the "allowDefinition='MachineToApplication'" error

Tech-Archive recommends: Fix windows errors by optimizing your registry



Usually, what happens is that you use those sections in web.config,
in order to override default settings set in machine.config.

Check your web.config...and see which setting you're using which overrides a default
machine.config setting which is configured as allowDefinition='MachineToApplication'.



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/
===================================
<deathtospam@xxxxxxxxx> wrote in message
news:1163171471.175710.147340@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Juan --

So whether or not I need to use a virtual directory depends on whether
I make use of any of the sections that have
[allowDefinition='MachineToApplication'] in machine.config.comments?
I'm assuming I can determine what sections I use by poring over all the
"using <namespace>" statements at the top of my code-behind -- is that
correct? Here's a list of those using statements from the top of my
codebehind (CS) page:

==============================================
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Globalization;
==============================================

From what I can tell, I don't use any of the namespaces
[allowDefinition='MachineToApplication'] declared in the
machine.config.comments file. Or am I still missing something?


-= Tek Boy=-


Juan T. Llibre wrote:
re:
Do I need to create a virtual directory for each and every project I
want to test?

No. Only for the ones which use sections defined as
allowDefinition='MachineToApplication' in its configuration file.

re:
Is that belief mistaken?

No, it's not, but the same rules apply for the internal web server as for IIS.
If you need to use 'MachineToApplication' sections, you must create a virtual directory.

Take a look at machine.config.comments in:
Drive:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\CONFIG

Search for allowDefinition="MachineToApplication" in that file.
You will find 17 sections marked as allowDefinition="MachineToApplication".

If you use any of those sections, you'll need to create a virtual directory.
If you don't use any of those sections, you don't need to create a virtual directory.



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/
===================================
<deathtospam@xxxxxxxxx> wrote in message
news:1163169612.271654.256720@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
I don't understand, though -- *what* became unmapped? I haven't
touched IIS on my machine to date, which is running a vanilla
installation of Windows XP Professional and Visual Studio .NET 2005.
Do I need to create a virtual directory for each and every project I
want to test?

I thought VS.NET 2005 came with its own internal IIS-Lite webserver,
which is why you can debug a project without configuring IIS, and which
is why you also see a dynamic port number when you debug a script
without actually deploying it. Is that belief mistaken?


-= Tek Boy =-


Alvin Bruney [MVP] wrote:
hmmm, you are best served by inspecting the IIS virtual directory to see if
it *somehow became unmapped. If it is, just create a new virtual directory
pointed to the application. And watch out for the little elves that change
things when no one is looking :-)

--
________________________
Warm regards,
Alvin Bruney [MVP ASP.NET]

[Shameless Author plug]
Professional VSTO.NET - Wrox/Wiley
The O.W.C. Black Book with .NET
www.lulu.com/owc, Amazon
Blog: http://www.msmvps.com/blogs/alvin
-------------------------------------------------------


<deathtospam@xxxxxxxxx> wrote in message
news:1163111193.739754.239210@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
A day or two ago, I wrote a quick ASPX page with a CS codebehind using
Visual Studio .NET 2005 -- it worked, I saved it and closed the
project. Today, I came back to the project, reopened the solution, and
was greeted with the following error:

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

I did some searching on Google, and all of the solutions to this
problem involved tweaking IIS. The thing is, I didn't have to touch
IIS when I wrote, compiled and ran the ASPX the first time around --
why would I have to do it during a subsequent visit?

If anybody has any suggestions on how to resolve this problem, I would
greatly like to hear them. Thanks in advance!


-= Tek Boy =-




.



Relevant Pages

  • Re: VS2008 HTTP 403 Help!!
    ... Juan T. Llibre, asp.net MVP ... asp.net faq: http://asp.net.do/faq/ ... That error is caused by a virtual directory not being configured as an application in IIS. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: VS2008 HTTP 403 Help!!
    ... Sure Juan - what's the url to the "Connect site"? ... Seems like the publish took away the projects web app status. ... and not IIS ... I created a virtual directory in IIS which points to the directory ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: VS.NET 2005 and the "allowDefinition=MachineToApplication" error
    ... configured as a virtual directory? ... Juan T. Llibre wrote: ... The only warning is that you can't include MachineToApplication configurations ... allowed in virtual directory and IIS website root directories? ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: IIS related ASP.NET page question
    ... "Juan T. Llibre" wrote in message ... > ASP.NET MVP ... >> I am using ASP.NET with IIS. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: publishing to iis 5.1
    ... and run the short script posted there to identify the account ASP.NET is running as. ... You haven't said which version of IIS, or which OS, you're running. ... >> Juan T. Llibre, ASP.NET MVP ...
    (microsoft.public.dotnet.framework.aspnet)