pythonflaskiiswfastcgi

IIS - Flask python script webconfig error wfastcgi


I am enabling flask python script with wfastcgi over IIS.

I have installed and enabled wfastCGI. However after i create a website and add webconfig file with below details -

<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<modules>
            <remove name="WebDAVModule" />
        </modules>
  <handlers>   
   <add name="Python FastCGI" path="*" verb="*" modules="FastCgiModule" scriptProcessor="c:\users\goe\appdata\local\programs\python\python38\python.exe|c:\users\goe\appdata\local\programs\python\python38\lib\site-packages\wfastcgi.py" resourceType="Unspecified" requireAccess="Script" />
  </handlers>
        <directoryBrowse enabled="true" />
</system.webServer>
<appSettings>
  <!-- Required settings -->
  <add key="WSGI_HANDLER" value="myapp.app" />
  <add key="PYTHONPATH" value="D:\" />
</appSettings>
</configuration>

However I see below error while try to verify handler mapping Filename

C:\Users\goe\Documents\mywebsite\webconfig Line number:7 
Error : The configuration section can not be used at this path. This happens when section is locked at parent level. Locking is either bu default (overrideModeDefault="Deny"), or set explictly by a location with overrideMode="Deny" or the legacy allowOverride="false"

I need help to fix this, please do needfulI


Solution

  • IIS return this error when you are not setting configuration in root web.config or you missed to install something in IIS.

    1.Please ensure C:\Users\goe\Documents\mywebsite\ is the root web.config of your web server. You need to make sure the handlers section is set in the root web.config of your web application.

    2.Please ensure

    <section name="handlers" overrideModeDefault="Allow" />
    

    3.Please go to configuration manager system.webServer/handlers and check whether section has been unlocked.

    4.Please ensure IIS feature has been installed completely.