Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

web.config generation in Asp.Net Core 2

I know that Core 2 is moving away from the web.config and towards Json configuration. However, I have come across an issue where by my IIS 7 server has WebDav installed which is blocking HTTP PUT requests to my webapi.

The following link has provided a working solution by removing WebDav;

Remove WebDav Web.Config for Core 1

The issue I am having is that I need to add this to the generated web.config on the server with every publish as it is being over written each time.

Is it possible for me to add a web.config to my Asp.Net Core 2 webapi? or tell it to add this to the one it is generating?

like image 444
Matthew Flynn Avatar asked Jan 24 '26 21:01

Matthew Flynn


1 Answers

In Asp.Net Core 2.1 I added web.config file into the root of project then remove WebDAV from module and handler

<system.webServer>
        <modules runAllManagedModulesForAllRequests="false" xdt:Transform="Insert" >
            <remove name="WebDAVModule" />
        </modules>
        <handlers>
            <remove name="WebDAV"/>
         </handlers>
</system.webServer>

The web.config file is generated when you are publishing the project. It works for me.

like image 130
shahab javanmardi Avatar answered Jan 26 '26 14:01

shahab javanmardi