HttpError iis config throws exception when default path is added

后端 未结 4 1885
失恋的感觉
失恋的感觉 2020-12-16 19:39

I have this config which works and redirects the following errors correctly



        
4条回答
  •  借酒劲吻你
    2020-12-16 20:39

    This is becuase IIS by default (Ive just discovered this with IIS 10) at a server level locks defaultPath.

    The error is saying some parent web.config attribute has been locked so you're not allowed to overwrite it.

    The way to change this is to

    1. Open IIS
    2. Select the top level node in the tree (Your server/computer name most likely)
    3. Click the 'Configuration Editor' icon in the last row.
    4. Enter 'system.webServer/httpErrors' into the section dropdown at the top
    5. Right click the defaultPath
    6. Go to the 'defaultPath' attribute > sub menu
    7. Click Unlock attribute
    8. Click Apply Changes in the top right

    I'd generally recommend against this though, as you'll have to do this on every server you deploy the site to. (and I'm also not sure how something like Azure Web apps that dont give you this level of access handle it)

提交回复
热议问题