It is an error to use a section allowDefinition='MachineToApplicat

N

Neal Miller

Hi, I'm getting 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 have researched this issue a lot, and can say that:
1) The Application's Path is "C:\Inetpub\wwwroot\Appname".
2) This path is defined as a Virtual Directory in IIS.
3) The Application has a subfolder named "Administration".
4) The "Administration" subfolder is also defined as a Virtual Directory.
5) The web.config file in the Appname folder contains the following text:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
<!-- xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0"-->
<system.web>
<compilation defaultLanguage="c#" debug="true"/>
<xhtmlConformance mode="Legacy" />
<customErrors mode="Off"/>
<authentication mode="Forms">
<forms timeout="2000">
<credentials passwordFormat="Clear">
<user name="username1" password="pwd1"/>
</credentials>
</forms>
</authentication>
<authorization>
<deny users="?"/>
</authorization>
<trace enabled="false" requestLimit="10" pageOutput="true"
traceMode="SortByTime" localOnly="false"/>
<sessionState mode="InProc" stateConnectionString="tcpip=127.0.0.1:42424"
sqlConnectionString="data source=127.0.0.1;Trusted_Connection=yes"
cookieless="false" timeout="2000"/>
<globalization requestEncoding="utf-8" responseEncoding="utf-8"/>
</system.web>
</configuration>

6) The web.config file in the Administration subfolder contains the
following text:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
<!-- xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0"-->
<system.web>
<compilation defaultLanguage="c#" debug="true"/>
<xhtmlConformance mode="Legacy" />
<customErrors mode="Off"/>
<authorization>
<deny users="?"/>
</authorization>
<trace enabled="false" requestLimit="10" pageOutput="true"
traceMode="SortByTime" localOnly="false"/>
<sessionState mode="InProc" stateConnectionString="tcpip=127.0.0.1:42424"
sqlConnectionString="data source=127.0.0.1;Trusted_Connection=yes"
cookieless="false" timeout="2000"/>
</system.web>
</configuration>

VS.NET 2005 comes up with the above error on the SessionState line here on
this subfolder's web.config file. If I remove the sessionState section on
this subfolder's web.config file and re-build, then many pre-compile errors
are detected in VS 2005, including many "Error 2 The name 'Global' does not
exist in the current
context C:\Inetpub\wwwroot\Appname\Administration\ReceiveSystem.aspx.cs 23
", and this error: Warning 1 Invalid search path 'C:\PROGRAM\PCOBOL32'
specified in 'LIB environment variable' -- 'The system cannot find the path
specified. '

If I leave the subfolder's web.config sessionState parameter in it, I only
get the "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." error.

I am aware that sessionState is only supposed to be defined in the top-most
level, but if I do so, I would appreciate any assistance in overcoming the
other errors that I mentioned above.

Thanks in advance.
 
N

Neal Miller

FYI: I resolved the outstanding issue(s).

There were a number of problems in this application, which I converted from
1.1.

1) Multiple web.config files were not necessary. The orig app had them. I
removed all but the web.config in the main folder, and the
"MachineToApplication" error went away.

2) The original programmer coded database access logic in a Global.asax.cs
code-behind file. This does not work very well in 2.0. I moved that common
logic to a new class, then deleted the Global.asax and Global.asax.cs files,
since no other custom logic existed there, converted all code that reference
the former Global. logic to the new class, and that resolved many of the
outstanding issues.

3) I modified all SqlCommand.Parameter.Add logic to use the new 2.0 format
to eliminate many of the deprecated command warnings.

The application now compiles and runs successfully with no errors or warnings.
 

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

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,073
Latest member
DarinCeden

Latest Threads

Top