web.config allowDefinition=MachineToApplication error

前端 未结 9 1251
没有蜡笔的小新
没有蜡笔的小新 2021-01-05 01:41

Under the root directory I have the following structure

..
..
..
web.config
Report Folder
- Login.aspx
- Web.config
  |
  |-> ViewReport
       |       
          


        
相关标签:
9条回答
  • 2021-01-05 02:02

    Create a virtual directory at the site root. This can be done via project properties in VS under the Web tab.

    It's also possible that you have things defined in the sub-directory that should be in the root config file. See similar question here:

    Error to use a section registered as allowDefinition='MachineToApplication' beyond application level

    0 讨论(0)
  • 2021-01-05 02:04

    Just add this below lines in your csproject file to clean up the obj/bin folder automatically.

    <Target Name="BeforeBuild">
      <!-- Remove obj folder -->
      <RemoveDir Directories="$(BaseIntermediateOutputPath)" />
      <!-- Remove bin folder -->
      <RemoveDir Directories="$(BaseOutputPath)" />
    </Target>
    
    0 讨论(0)
  • 2021-01-05 02:04

    This error occur if your web.config file and your all aspx file are not in the same folder. so please put all the files in the same folder.

    Thanks.

    0 讨论(0)
  • 2021-01-05 02:05

    The contents of the web.config in the subdirectory should be placede in the root directory. The configuration in the subdirectory is making IIS treat the subdirectory as the application root but it is not the application root. This is why you get the error allowDefinition='MachineToApplication'.

    0 讨论(0)
  • 2021-01-05 02:06

    Converting your folder/project into an application in IIS can resolved this error.

    0 讨论(0)
  • 2021-01-05 02:12

    If you put the published files in inetpub/wwwroot/../ Make sure to add the root folder as an application in IIS Manager.

    0 讨论(0)
提交回复
热议问题