locked
error when trying to connect the application fromthe remote machine RRS feed

  • Question

  • User1916879340 posted
    Hi, I have made one web application using Asp dot net 2005 and sql server 2005.The sql server i am connecting is the remote sql server..When i run my application in my computer and in LAN, it worked without any error..I run it after publishing it and even making virtual directory..It worked fairly...But when i upload the application to the remote machine.e i uploaded my application(published application including virtual directory) and try to run my application from the remote server.But when i try to run it, it gives configuration error like below: Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately. Parser Error 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. Why this error comes ??Shall i have to do anything in configuration file ..????In the above error, it is saying Virtual directory not being configured..But i did create virtual directory and run it in LAN..It's working but when trying to run it from remote computer(through ftp), its not working...How can i get out of it ??
    Friday, October 5, 2007 6:59 AM

Answers

  • User-2060689755 posted

    Hi SayamiSuchi,

    You may get this error when trying to browse an asp.net application.

    The debug information shows that "This error can be caused by a virtual directory not being configured as an application in IIS."

    However, this error occurs primarily out of 2 scenarios.

    1. When you create an new web application using visual studio.net, it automatically creates the virtual directory and configures it as an application. However, if you manually create the virtual directory and it is not configured as an application, then you will not be able to browse the application and may get the above error. The debug information you get as mentioned above, is applicable to this scenario.

    To resolve it, Right Click on the virtual directory - select properties and then click on
    "Create" next to the "Application" Label and the textbox. It will automatically create the "application" using the virtual directory's name. Now the application can be accessed.


    2. When you have sub-directories in your application, you can have web.config file for the sub-directory. However, there are certain properties which cannot be set in the web.config of the sub-directory such as authentication, session state (you may see that the error message shows the line number where the authentication or sessionstate is declared in the web.config of the sub-directory). The reason is, these settings cannot be overridden at the sub-directory level unless the sub-directory is also configured as an application (as mentioned in the above point).

    Mostly we have the practice of adding web.config in the sub-directory if we want to protect access to the sub-directory files (say, the directory is admin and we wish to protect the admin pages from unathorized users).

    But actually, this can be achieved in the web.config at the application's root level itself, by specifing the location path tags and authorization, as follows:-


    <location path="Admin">
         <system.web>
           <authorization>
    <allow roles="administrators" />
    <deny users="*" />
           </authorization>
         </system.web>
    </location>



    However, if you wish to have a web.config at the sub-directory level and protect the sub-directory, you can just specify the Authorization mode as follows:-

    <configuration>
    <system.web>
    <authorization>
          <allow roles="administrators" />
          <deny users="*" />
    </authorization>
    </system.web>
    </configuration>

     For more information:
    http://forums.asp.net/t/769696.aspx

    Best regards,
    Guang-Ming Bian - MSFT

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, October 10, 2007 3:08 AM

All replies

  • User-1831161647 posted

    this also fires as an error when you have more than 1 config file...as in  central virtual directory and then a subset folder with another web.config not being configured as a virtual directory

    Friday, October 5, 2007 9:24 AM
  • User1916879340 posted

    I am sure that in my application, there is only one web.config file.

    Tuesday, October 9, 2007 1:40 AM
  • User-2060689755 posted

    Hi SayamiSuchi,

    You may get this error when trying to browse an asp.net application.

    The debug information shows that "This error can be caused by a virtual directory not being configured as an application in IIS."

    However, this error occurs primarily out of 2 scenarios.

    1. When you create an new web application using visual studio.net, it automatically creates the virtual directory and configures it as an application. However, if you manually create the virtual directory and it is not configured as an application, then you will not be able to browse the application and may get the above error. The debug information you get as mentioned above, is applicable to this scenario.

    To resolve it, Right Click on the virtual directory - select properties and then click on
    "Create" next to the "Application" Label and the textbox. It will automatically create the "application" using the virtual directory's name. Now the application can be accessed.


    2. When you have sub-directories in your application, you can have web.config file for the sub-directory. However, there are certain properties which cannot be set in the web.config of the sub-directory such as authentication, session state (you may see that the error message shows the line number where the authentication or sessionstate is declared in the web.config of the sub-directory). The reason is, these settings cannot be overridden at the sub-directory level unless the sub-directory is also configured as an application (as mentioned in the above point).

    Mostly we have the practice of adding web.config in the sub-directory if we want to protect access to the sub-directory files (say, the directory is admin and we wish to protect the admin pages from unathorized users).

    But actually, this can be achieved in the web.config at the application's root level itself, by specifing the location path tags and authorization, as follows:-


    <location path="Admin">
         <system.web>
           <authorization>
    <allow roles="administrators" />
    <deny users="*" />
           </authorization>
         </system.web>
    </location>



    However, if you wish to have a web.config at the sub-directory level and protect the sub-directory, you can just specify the Authorization mode as follows:-

    <configuration>
    <system.web>
    <authorization>
          <allow roles="administrators" />
          <deny users="*" />
    </authorization>
    </system.web>
    </configuration>

     For more information:
    http://forums.asp.net/t/769696.aspx

    Best regards,
    Guang-Ming Bian - MSFT

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, October 10, 2007 3:08 AM