Wednesday, April 29, 2009

It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level

Problem :-  It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level

 

Solution :- There Are Mainly One of the Two Reason Why you Got this Error Message.

1.   If you Have Not configured your asp.net application in IIS.  If you have not Configure your application to run on IIS First Configure your Site to Run on IIS.For that Create Virtual Directory From IIS and Give Permission to Application (Read,Write)

 

2. If Above is Not Problem Then There are Mainly Problem of Two or many Web.Config Exists on your Site.When you Open Some Site and if Software Crate Backup of that Application then Software mainly Do Create Subfolder and Copy All Files + Web.Config in Application.Just Remove this Subfolder web.config from Subfolder. 

 

Let me Know if You Know Anything More or want to Know More .....

 . 

 

Prev Post                    All Post                           Next Post

77 comments:

  1. Thanks Ketan

    I have same Problem but i seen there are two web.config first in main folder and second one in sub folder.

    I remove and My Application now working

    Thanks once again for your Solution.

    ReplyDelete
    Replies
    1. Thanks my problem was also had similar resemblance with you problem and i solved it by watching your suggestion.

      Delete
    2. Thanks my pblm also solved.
      i have moved my web config files to my sub folder
      It is working fine

      Delete
  2. Thanks.... when i upgraded to VS2008 it had created a backup folder inside my project folder and this was causing the problem

    ReplyDelete
  3. Hello
    I Have many web.congig in my application subfolder and i have need of them (for Rolls like admin)whate i do now

    ReplyDelete
  4. Hello Sandip,

    If there are different application in one application then you can create different virtual directory for different application.

    Otherwise for same application there are no possibility two have many configuration file.

    I have done similar type of situation during my project in which i have two application in one application first one main application and second one is Photo capture application which is part of main application but photo capture application also have configuration file.But i have create different virtual directory for it. and there are no problem with this application.




    Can you say me in detail what type of situation in your application ????

    ReplyDelete
  5. When this happens to me it is because the vS conversion wizard automatically creates a backup directory under the root of the website. Just delete the directory and it should then compile

    ReplyDelete
  6. Hi, I also got the same error:

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

    -I created vitual directory for that web application and map the directory but it doesn't work when i upload files and run on web server.

    ReplyDelete
  7. Hello Raining Forever.

    There are Many Criteria For This.You can me Write on Detail on ketan_erp@yahoo.com Or Can Caught On Yahoo messenger id : - ketan_patel3536@yahoo.com After 8 P.M (IST)

    ReplyDelete
  8. Thanks; I only realized by this post that I had an extraneous web.config in a subdir

    ReplyDelete
  9. Hi one doubt since im new to web development. my doubt is even if the application is not configured in iis it will be able to build it locally right?
    I copied an application from another machine to mine and tried to build it Im getting this error.

    ReplyDelete
  10. i want to know more

    ReplyDelete
  11. my application is configured as web application in iis and it has just one web.config file on the root, still has the problem, pls help

    ReplyDelete
  12. @above

    Check that you are running main Folder name Which Contain web.config.

    Exmaple id your site name is Technical then web.config include in Technical/web.config

    Now Suppose there are another folder New folder/Technical Now if you run as a New folder and your config file in New Folder/Technical/web.config then same Error Come.Please check it.

    ReplyDelete
    Replies
    1. i have an app deployed, next I added a new folder and placed new app in it. originalApp/newApp/page

      both originalApp and newApp has web.config

      what to do ? pls help

      Delete
  13. Thanks for the information! I have recieved this error message several times and couldn't figure out what to do. Your post was very helpful! thanks so much

    ReplyDelete
  14. Thank you for advice! I ran into this error when I ran a conversion from VS2005 to VS2008 and I googled for a resolution.

    For some reason web.config files were placed under application root folder and project stopped compiling.

    After deleting web.config files I am back in the game.

    ReplyDelete
  15. I have same problem. I have a visual studio solution of our application. I have two application means I integrated one application , inside another application and we have two config file of these application. I configure both application in IIS but when I build my solution , it is giving same error, Please help me

    ReplyDelete
  16. error is

    E:\AmitSamples\YAF\yetanotherforum\web.config(35): Build (web): 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.

    ReplyDelete
  17. Hi Amit,

    I think you have two web application in one solution. in this case it's not cause a problem.I have also same situation in my project. There are four web application (web,mobile,home site etc..)
    but it's not causing any problem.

    you make sure that u have one solution and in that two web application and also set one application as a start up project.

    you can mail me on my email id or cont in this.

    Enjoy !!!!!!

    ReplyDelete
  18. Yes I have one solution and also set one application as a start up project but still I am facing same problem.
    I explain my application
    In my web application I have another web application like YetAnotherForum application.
    This application has its web.config and our parent web application its web.config. I add YAF solution inside a folder which is child folder of parent web application.

    I have machine key same in both config file for integration.

    These above all things I have in my application.

    it is not working local its giving same error but on server it is working fine. I need it bcs I wants to do debug in nested application from my web application

    please send me solution asap.

    ReplyDelete
  19. Hi amit,

    In this case u can solve by two way.

    1.) There are two web.config in your solution in root directory and second in sub folder. Do one thing remove some section from Sub folder web.config it's not cause any problem because it's inheritance from root web.config.

    Remove section like , etc .. which are already in root directory.

    Let me know if this is work for you or not.

    2.) If u r running from visual studio then u can run and debug the application. you can run your application by disabling error checking u can search more on google or if want more help on it then let me know.

    Please back to me if any solution work for you.

    ReplyDelete
  20. Hello,

    I have an app that has admin folder with web.config in it, have tried all of the above but still get the errors. :((

    ReplyDelete
  21. Hi @above

    why u used two web.config.

    All u can archive using single web.config.

    August 27, 2010 1:52 AM

    ReplyDelete
  22. Hi Ketan,

    I no nothing about the application, I have had to move servers and this one must be setup way different.
    I have removed the duplicate entries from the admin web.config and that fixed the initial error but now get error...

    Exception Details: System.Data.SqlClient.SqlException: Could not find stored procedure 'CMRC_Manf'.

    thanks
    tom

    ReplyDelete
  23. Hi tom,

    Now it's your Database error. in Database given store procedure not found. check whether your given database contain sp name with "CMRC_Manf".

    ReplyDelete
  24. Hello;

    I am running into a similar issue. I had our web-site hosted on our local server and when I moved to LinkDotNet I get the below error. The web-page works fine it is when I try to go to the Admin Login page that I get this error.

    Server Error in '/' Application.
    --------------------------------------------------------------------------------

    Configuration Error
    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.

    Source Error:


    Line 70:
    Line 71: -->
    Line 72:
    Line 73:

    ReplyDelete
  25. Ok,

    for some reason it keeps leaving the error information out when I post, so I took the < off to see if that would help

    Line 70:
    Line 71: -->
    Line 72: authentication mode="Forms"
    Line 73: !--AUTHORIZATION
    Line 74: This section sets the authorization policies of the application. You can allow or deny access

    ReplyDelete
  26. I had this error and the solution is that I had one extra folder and that had the web.config. The roort folder had no web.congig.

    I recrested the solution where under solution I have a folder that had web.config.

    ReplyDelete
  27. Thank you, the second one worked for me.

    ReplyDelete
  28. Thank u. It works

    ReplyDelete
  29. for me it was happening after a publish. there were conflicting web.config files.
    Solution was to delete everything in the obj folder

    ReplyDelete
  30. Thanks. Still relevant.
    I allowed VS2010 to upgrade a VS2008 solution, and it stopped working. I removed the backup files and all OK.

    ReplyDelete
  31. Hi I am getting this error when I m trying to consume my own web service in another website, while creating proxy using WSDL I dont have any of the cases unsolved i have applications in IIS and also no subfolders for web.config, Please help me :(

    ReplyDelete
  32. Can u send me coding on ketan_erp@yahoo.com with details. so i can help you.

    ReplyDelete
  33. Hiii ketan i have a problem i deploying my website on server side please help...!!

    It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level.

    ReplyDelete
  34. in line 36 itis written as

    ReplyDelete
  35. hi, thank you so much its working now. this was very helpful to get a success of me.
    siva sankar

    ReplyDelete
  36. hi , thank you so much its working fine now...

    ReplyDelete
  37. Thanks Yaar..

    ReplyDelete
  38. Hi,
    i also have same problem..
    in my case, my system is in asp classic..and i have to create one module using asp.net, then once the user login in using asp and go to the module in asp.net, im stuck in here..
    need help!!!
    Thanks
    Aleesya

    ReplyDelete
  39. after sending mail, it should jump on sendmail.asp page. please provide me solution for this..

    ReplyDelete
  40. I have an application which consists of four Projects, in which 1 is Presentation 2 Web Service 3. Web Service 4 Business logic.. The first project depends on 2nd Web Service and the 2nd Depends on 3rd and 3rd Depends on 4th... So I have created web references to connect frm one prj to other prj... but this application is working fine in my local machine but when I deployed in Dev Environment am getting an error. So I tried to make the web ref to be called dynamically through a tool and making stuff in each projects web.config file saying like below... (1st proj refering to 2nd proj and 2nd proj ref to 3rd proj) (add key="localWS" value="//localhost.xxxxx.com/2ProjName/ProductWS.asmx")
    (add key="DevWS" value="//dev1wssupplier.xxxxx.com/2ProjName/ProductWS.asmx"/)
    (add key="TestAWS" value="://tst1wssupplier.xxxxx.com/2ProjName/ProductWS.asmx"/)
    (add key="ProductionWS" value="://wssupplier.xxxxx.com/2ProjName/ProductWS.asmx"/)
    and calling the WS as
    ' call web service
    Dim proxyClass As New ProductProxy.ProdWS ('Where ProductProxy is namespace of the calling tool and ProdWs is the class name and below validateEntry is the function)
    result = proxyClass.ValidateEntry(CType(materialMaster, Integer), shipTo)
    proxyClass = Nothing
    End If
    am getting the value whn I keep the cursor at Proxyclass as "localhost.xxxxx.com/2ProjName/ProductWS.asmx"
    but after passing it am getting an error that
    Unable to automatically step into the server. The remote procedure could not be debugged. This usually indicates that debugging has not been enabled on the server.
    can anybody help me in this how to do???

    ReplyDelete
  41. Kindly some one help me in the above mentioned issue as early as possible... Its vry very urgent...

    ReplyDelete
  42. Hi My site had 2 web config i removed 1 of them still i get this error, even though only 1 web config file

    ReplyDelete
  43. Thanks! First solution worked for me! Was driving me nuts :)

    ReplyDelete
  44. Hi, Actually when i upgrade to VS 2008 It has created a new Folder with name backup inside my Main application folder which cause this Error.

    Resolution : Remove this backup folder from the main application folder.

    ReplyDelete
  45. Hi i m also getting the same 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."
    As i have configure my home directory and having number of supporting web.config file for admin purpose.
    when i double click on the error line its shows its location in web.config file at the line where the is written

    ReplyDelete
  46. Hi i m also getting the same 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."
    As i have configure my home directory and having number of supporting web.config file for admin purpose.
    when i double click on the error line its shows its location in web.config file at the line where the is written authentication mode="Forms"

    ReplyDelete
  47. Hello sagar,

    You can take multiple web.config in application. But make sure that base tag used only once. If based tag used many times then it's throw compile time error.

    Let me know if want more details on this.

    ReplyDelete
  48. Thanks a lot. it worked exactly as u told.
    Thanks again

    Nilesh K.
    nileshkolnoorkar@yahoo.com

    ReplyDelete
  49. Thank you so much! it worked as you suggested and very pleased.

    ReplyDelete
  50. well there is another case. if you open mvc project as a web site, then this error occurs. when you open it as a project then this error does not occur.

    ReplyDelete
  51. yes farrukh, you are rite. even you open simple asp.net projet as a website then you will get this error.

    thanks to point out.

    ReplyDelete
  52. I had the same error on a new MVC3 project, and resolved it by running a 'clean' on the solution and a 'clean' on the project.

    ReplyDelete
  53. hi ketan,
    im getting this error if i run that source code.pzl help me out actually im running that code for the first time.i need to do any setting before running code.

    this is the errror
    asp.net runtime error.it is an error to use a section register asallowDefinition='MachineToApplication' beyond application level

    ReplyDelete
  54. @pavana....

    no not need to do any setting.

    please verify above is not case with your application.

    n also verify that you have open solution file.

    ReplyDelete
  55. sir i have use visual studio 2010 but not run coding plee help me



    Server Error in '/CODING' Application.
    Configuration Error
    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.

    Source Error:

    Line 26: ASP.NET to identify an incoming user.
    Line 27: -->
    Line 28:
    Line 29: section enables configuration


    Source File: C:\Users\gopi\Desktop\credit-card-fraud-detection-using-hidden-markov-model-project-source-code\REVIEW MATERIALS\REVIEW MATERIALS\FINAL\CODING\itdns03\web.config Line: 28

    ReplyDelete
  56. Hi,
    I also get the same issue and get the best solution on below given link as you may get this error due to multiple reasons and both are explained and solved in below given link ...

    http://blog.geek4support.com/it-is-an-error-to-use-a-section-registered-as-allowdefinitionmachinetoapplication-beyond-application-level/

    ReplyDelete
  57. i am not able to run .asp file in VS05..please guide me what changes i have to do in IIS as well as in web config to rum the application

    ReplyDelete
  58. Hi my website run well upto 15 min after that i get the following
    error

    Validation of viewstate MAC failed. If this application is hosted by a Web Farm or cluster, ensure that configuration specifies the same validationKey and validation algorithm. AutoGenerate cannot be used in a cluster.

    so I set MachinKey in my web.config file. its getting another 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 am using only one web.config file in project please can any one help me out to resolve this error.

    ReplyDelete
  59. Thank you. You solution helped me.

    ReplyDelete
  60. Hi,

    I have created a application with one Webform1.aspx (VS2012)and run directly and its work fine, but when i configured the same with IIS then I got 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 given Add/Edit permission also.

    Please suggest me

    ReplyDelete
    Replies
    1. Hi Anulesh,

      Problem is not with your Add/edit Permission but it's seem that your root director is not your application please confirm with this. Application should be on root directory.


      Ketan Patel

      Delete
  61. Hi Ketan
    During debug i got below error

    Error at line 29:


    Error description:
    Error 1 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:\Gaurav\PartNumberGenerator09_05_2012\PartNumberGenerator27\Web.config 29

    I have already excluded 2nd web.config file from project

    ReplyDelete
    Replies
    1. Hello,

      Are you sure you have only one web.config and also make sure that if you are running main website.

      Delete
  62. Clean solution, Rebuild solution, and everything works. (in my case).

    ReplyDelete
    Replies
    1. Hello @Above,

      Some time Visual studio act like childy :D

      Delete
  63. thanku guys... but one thing i never created ../ccbweb/ccbweb folder i dont know what was the problem i just renamed inner most ccbwe folder like ../ccbweb/ccbweb_useless after that all working fine

    ReplyDelete
  64. Thanks The solution of this error you are not chooseing correct path when deploying!!!

    ReplyDelete
  65. In my case the Publish tool created a copy in obj\Release\Package\PackageTmp\. Possibly a previous publish failed and it did not tidy up on completion. Clean did not remove it.

    ReplyDelete
  66. i copy the connection string from second web.config file and paste it in first. Then i removed second web.config. Now its working fine for me.

    ReplyDelete
  67. using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Data;
    using System.Data.SqlClient;
    using System.Configuration;
    using System.Collections;
    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.Net.Mail;


    ///
    /// Summary description for DAL
    ///
    public class DAL
    {

    public string _ConnString = System.Configuration.ConfigurationManager.ConnectionStrings["CRM"].ConnectionString;

    public SqlDataReader GetDataReader(string sSQL)
    {
    // Create Instance of Connection and Command Object
    SqlConnection myConnection = new SqlConnection(_ConnString);
    SqlCommand cmd = new SqlCommand(sSQL, myConnection);
    SqlDataReader result = default(SqlDataReader);

    // Execute the command
    try
    {
    cmd.CommandType = CommandType.StoredProcedure;
    myConnection.Open();
    result = cmd.ExecuteReader(CommandBehavior.CloseConnection);
    }
    catch (Exception ex)
    {
    if (ex.ToString() == "")
    {

    }
    return null;
    }

    // Return the datareader result
    return result;
    }

    public SqlDataReader GetDataReader(string sSQL, SortedList paramList)
    {
    // Create Instance of Connection and Command Object
    SqlConnection myConnection = new SqlConnection(_ConnString);
    SqlCommand cmd = new SqlCommand(sSQL, myConnection);
    SqlDataReader result = default(SqlDataReader);
    int x = 0;
    // Execute the command
    try
    {
    cmd.CommandType = CommandType.StoredProcedure;
    for (x = 0; x <= paramList.Count - 1; x++)
    {
    cmd.Parameters.AddWithValue((String)paramList.GetKey(x), paramList.GetByIndex(x));
    }
    myConnection.Open();
    result = cmd.ExecuteReader(CommandBehavior.CloseConnection);
    }
    catch (Exception ex)
    {
    if (ex.ToString() == "")
    {

    }
    }
    // Return the datareader result
    return result;
    }

    public DataSet GetDataSet(string sSQL, SortedList paramList)
    {
    // Create Instance of Connection

    SqlConnection myConnection = new SqlConnection(_ConnString);
    SqlCommand cmd = new SqlCommand(sSQL, myConnection);
    int x = 0;
    cmd.CommandType = CommandType.StoredProcedure;
    cmd.CommandText = sSQL;
    cmd.Connection = myConnection;
    for (x = 0; x <= paramList.Count - 1; x++)
    {
    //cmd.Parameters.Add(paramList.GetKey(x), paramList.GetByIndex(x));
    cmd.Parameters.AddWithValue((String)paramList.GetKey(x), paramList.GetByIndex(x));
    }
    SqlDataAdapter myAdapter = default(SqlDataAdapter);
    myAdapter = new SqlDataAdapter(cmd);

    DataSet result = new DataSet();
    try
    {
    myAdapter.Fill(result);
    }
    catch (Exception ex)
    {
    if (ex.ToString() == "")
    {

    }
    return result;
    }
    // Return the datareader result
    return result;
    }

    ReplyDelete
  68. i have make application without configure IIS but now we can configure and then i can upload my file so what i can do coz error is that
    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.
    please give me some solution and also told my how we can configure root directory coz i am hosting first time on server.
    please any one can help me.

    ReplyDelete