custom webdav implementation in IIS, gives 405 on PROPFIND - iis

I have created a custom webdav implementation with a HttpHandler, to serve files in a database via webdav protocol to a client.
On Cassini, my VS Development server I can access this without problems.
Now I am trying to debug this site in IIS, and that doesn't work.
I have the IIS 7.5 Webdav module uninstalled.
Some snippets of my web.config:
<system.web>
...
<httphandlers>
<add type="Test.WebDAVHandler, Test" verb="*" path="*"></add>
</httphandlers>
...
</system.web>
<system.webserver>
<modules runAllManagedModulesForAllRequests="true">
<remove name="WebDAVModule">
</remove>
</modules>
<validation validateIntegratedModeConfiguration="true">
<defaultdocument enabled="true">
<files>
<add value="example.aspx"></add>
</files>
</defaultdocument>
<handlers accessPolicy="Read,Write,Execute,Script">
<remove name="WebDAV">
<add name=".NET Runtime" verb="*" path="*" preCondition="classicMode,runtimeVersionv2.0,bitness64" requireAccess="None" resourceType="Unspecified" scriptProcessor="C:\Windows\Microsoft.NET\Framework64\v2.0.50727\aspnet_isapi.dll" modules="IsapiModule">
</add>
</handlers>
</validation>
</system.webserver>
When I connect to this site by using the Map network drive option of Windows 7 and inspect the requests using Fiddler, I see that the after some authentication, the client does the following request:
OPTIONS localhost/explorer and gets the following (shortened) response.
HTTP/1.1 200 OK
Allow: OPTIONS, TRACE, GET, HEAD, POST
I am missing some allowed verbs here, like PROPFIND.
The next request the client does is a PROPFIND.
The server responds with a 405 Method not allowed.
I looked at the request tracing, and the DefaultDocumentModule is causing this error.
When I disable this module, the DirectoryListingModule causes this 405.
Does anyone have a clue how to fix this, so that I can use webdav with my custom handler?

Related

blazor server app 404 on publish at / on IIS

I have a blazor app that is running fine on localhost.
Here's the steps I have taken to put my project live.
Setup new Windows Server on AWS.
Enabled IIS.
Installed ASP.NET Core Runtime Hosting Bundle.
Installed the URL Rewrite module.
Setup a SSL cert and DNS settings to point to IP.
Configured bindings to port 443 and picked the cert added path wwwroot/projectname
published my project using web deploy.
However, when navigating to my url I'm seeing 404 resource not found.
Only thing that is different is that the server added a web config to get it to run in IIS which looks like this.
<configuration>
<location path="." inheritInChildApplications="false">
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" />
</handlers>
<aspNetCore processPath="dotnet" arguments=".\App.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" hostingModel="inprocess" />
</system.webServer>
</location>
</configuration>
<!--ProjectGuid: 8b081fc5-0f9d-4426-b9cf-90f4d30b5527-->
Anyone point me in the right direction as to what I should be looking out for or steps I may have missed as this is the first time I've attempted publishing a Blazor-Server application.
On my IIS, I have "AspNetCoreModuleV2" not "AspNetCoreModule" like this:
<configuration>
<location path="." inheritInChildApplications="false">
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
</handlers>
<aspNetCore processPath="dotnet" arguments=".\App.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" hostingModel="inprocess" />
</system.webServer>
</location>
</configuration>
<!--ProjectGuid: 8b081fc5-0f9d-4426-b9cf-90f4d30b5527-->
See: Hosting A Blazor Visual Studio Project Directly In IIS

.NET Core App | IIS | HTTP Error 500 - Could not load configuration. Exception message: Attribute 'processPath' is required

I'm trying to host two applications in IIS in Windows Server 2019, in the same site. One of the applications is a website's front-end, in Angular, and the other one is the website's API, in ASP.NET MVC (.NET Core 2.2.8).
The front-end application's URL is site_url/portal and the API's is site_url/api.
Before using the API's other actions, one has to request a JSON web token from the site_url/api/identity URL, using Windows Authentication.
The front-end seems to be working fine, but trying to reach the site_url/api/identity API in the quality control environment yields "HTTP Error 500.0 - Internal Server Error".
I activated detailed logs in IIS and the error message in Event Viewer was "Could not load configuration. Exception message: Attribute 'processPath' is required."
The API's web.config file does have a process path:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<location path="." inheritInChildApplications="false">
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
</handlers>
<aspNetCore processPath="dotnet" arguments=".\PortalAPI.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" hostingModel="InProcess" forwardWindowsAuthToken="true"/>
</system.webServer>
</location>
</configuration>
Aditionally, the IIS error page shows something which I find strange. The request URL is correct, but the physical path is application_path\identity. "Identity" is an MVC controller, not a file.
The .NET Core 2.2 Windows Hosting Bundle is installed and the .NET path environment variable is set.
The application pool identity is an applicational user, and .NET CLR version is set to "No Managed Code".
The site has both Anonymous Authentication (for the front-end login page) and Windows Authentication enabled.
The thing is, I have hosted the applications in the exact same way in both the development environment and a clean Azure virtual machine, and they work in both, which makes me think this has to do with some setting in either IIS or the quality control machine itself.
Does anyone have any idea what the problem and/or possible solutions might be?
A missing configuration caused this error for me until I added it: environment variable ASPNETCORE_ENVIRONMENT
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
</handlers>
<aspNetCore processPath="dotnet" arguments=".\PortalAPI.dll" stdoutLogEnabled="true" stdoutLogFile=".\logs\stdout" hostingModel="InProcess" >
<environmentVariables>
<environmentVariable name="ASPNETCORE_ENVIRONMENT" value="Development" />
</environmentVariables>
</aspNetCore>
</system.webServer>
You can put this in web.config, but it will get removed if you publish a new version of the web app from Visual Studio. To avoid that, put it in applicationHost.config instead (in the location corresponding to your site).

receiving error 500.19 when attempting to launch website

We are moving our websites from a 2008 r2 server running IIS 7.5. The first program I moved over was asp.net core when attempting to run it I get the error HTTP Error 500.19 - Internal Server Error with the error code 0x8007000d. This starts my internet search unfortunately I don't have a config error which would narrow down the search quite a bit and none of the solutions I found worked. This code works on the old server just fine and I don't have anything in my code specifying the cpu so it not set to 32 bit.
Everything I have tried points me in the direction that the web.config file cannot be accessed. one of the reasons I say that is when I try to open configuration editor I receive the error the data is invalid (Exception from HRESULT: 0x8007000D) below is the web.config that I am using.
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<location path="." inheritInChildApplications="false">
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" />
</handlers>
<aspNetCore processPath="dotnet" arguments=".\Brochure_Fulfillment.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" />
</system.webServer>
</location>
</configuration>
<!--ProjectGuid: e089189f-00f3-48ee-9532-1c03776dad6a-->

Edit Web.config file

I have the following webconfig file produced by visual studio 2017 on a .net core application
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" />
</handlers>
<aspNetCore processPath="dotnet" arguments=".\SportsStore.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" />
</system.webServer>
</configuration>
<!--ProjectGuid: 5795049b-4d7e-4559-9010-f9134df11849-->
Although the publish succeed I get the following on the web page
Detailed Error Information:
Module
IIS Web Core
Notification
BeginRequest
Handler
Not yet determined
Error Code
0x8007000d
Config Error
Config File
\\?\C:\inetpub\wwwroot\sportstore\web.config
Requested URL
http://localhost:80/sportstore
Physical Path
C:\inetpub\wwwroot\sportstore
Logon Method
Not yet determined
Logon User
Not yet determined
Config Source:
-1:
0:
Because I have already work only on apache and the build in IIS express of visual studio I do not know where to start from. Internet has plethora of info and I tried many things but nothing.
Any suggestion?

NodeJS Azure Website returns 405 on HTTP POST

I provisioned an Azure Website and put an express (nodejs) application on it. The website does not have any special configuration to it, I simply provisioned it and enabled node 0.12.0 in the configuration.
I have an app.post method within the express app, which receives an html form from the browser. However, upon trying to submit this form to the express server, the server returns a 405 Method not Allowed error.
I am suspecting something in IIS is triggering this error, but I have not been able to find a solution. My web.config file allows all verbs for the nodejs app, as shown here:
<configuration>
<system.webServer>
<handlers>
<add name="iisnode" path="app.js" verb="*" modules="iisnode"/>
</handlers>
Try first removing any existing handlers and then adding the new handler:
<handlers>
<remove name="iisnode" />
<add name="iisnode" path="app.js" verb="*" modules="iisnode" />
</handlers>
Working answer proposed on MSDN Forums:
Comment out this line from the web.config file:
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="True"/>

Resources