2

I am getting an error

This configuration section cannot be used at this path. This happens when the section is locked at a parent level.

due to config entry at line 27 given below. I tried fixing it by unlocking the section websocket in Configuration Editor in IIS but it didn't work. The service works fine as soon as I remove line 27.

   26:     </handlers>
   27:     <webSocket enabled="true" />
   28:   </system.webServer>

Below is complete Error Message:

This configuration section cannot be used at this path. This happens when the section is locked at a parent level. Locking is either by default (overrideModeDefault="Deny"), or set explicitly by a location tag with overrideMode="Deny" or the legacy allowOverride="false".

Providing image for reference.

enter image description here Adding my configuration editor setting for WebSocket too.

enter image description here

The section in web.config is below:

  <system.webServer>
    <webSocket enabled="true" />
    <handlers>
      <remove name="ExtensionlessUrlHandler-Integrated-4.0" />
      <remove name="OPTIONSVerbHandler" />
      <remove name="TRACEVerbHandler" />
      <add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="*" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />
    </handlers>
  </system.webServer>
Madhur Maurya
  • 806
  • 1
  • 13
  • 32

1 Answers1

4

This error cause when the section is locked at the parent level. you could follow below steps to unlock section at parent level:

1) In the connections tree(in IIS), select your website from the connection pane.

2) Select Configuration editor from feature view.

3) In the window that opens, on top, you will find a drop-down for sections. Choose "system.webServer/WebSocket" from the drop-down.

5) On the right side, there is another drop down. Choose "ApplicationHost.Config "

6) From Action pane, you will find "Unlock Section" under "Section" heading. Click on that.

7) Once the WebSocket at the applicationHost is unlocked, restart IIS and run site.

enter image description here

Regards, Jalpa

Jalpa Panchal
  • 5,345
  • 1
  • 4
  • 17
  • Hi @jalpa-panchal This is exactly what I am doing but still facing the same issue. Anything else that I might be missing ? – Madhur Maurya May 09 '19 at 05:57
  • Do you want to enable WebSocket at site level? – Jalpa Panchal May 09 '19 at 06:01
  • Could you share your configuration editore setting for WebSocket? – Jalpa Panchal May 09 '19 at 06:03
  • I have updated the question with configuration editor setting for WebSocket. – Madhur Maurya May 09 '19 at 06:09
  • this setting is related to server levl.could you share site-level setting? – Jalpa Panchal May 09 '19 at 06:18
  • Do you want to enable or disable WebSocket at site level? – Jalpa Panchal May 09 '19 at 06:18
  • you could also try to modify applicationhost.config file.1) Browse to “C:\Windows\System32\inetsrv\config” (you will need administrator rights here) Open applicationHost.config 2) Find the section that showed up in the “config source” part of the error message page. For me this has typically been “modules” or “handlers”. 3)Change the overrideModeDefault attribute to be Allow. its lokk like this:
    and restart iis server.
    – Jalpa Panchal May 09 '19 at 06:21
  • I tried last step mentioned above. overrideModeDefault was already set to Allow but I am facing same issue. Just to mention one more thing. I am running a .net web API that is hosted on http://localhost:25002/ when I build it. – Madhur Maurya May 09 '19 at 06:32
  • taht chcek the In IISExpress and Visual Studio 2015 the applicationHost.config is stored in $(solutionDir).vs\config\applicationhost.config – Jalpa Panchal May 09 '19 at 06:34
  • Thanks Jalpa. This worked for me! I updated $(solutionDir).vs\config\applicationhost.config to set overrideModeDefault="Allow" – Madhur Maurya May 09 '19 at 06:55
  • After doing all the above, I get a HTTP 500.21: Handler "ExtensionlessUrlHandler-Integrated-4.0" has a bad module "ManagedPipelineHandler" in its module list. But I was able to fix using this answer: https://stackoverflow.com/a/15101051/1602584 – Ash May 02 '20 at 06:25