Blazor webassembly on IIS 10 - 404 for some dlls - iis

My Blazor webassembly app runs fine localy. When I deploy it to IIS 10 on a Windows Server 2016, the app fails to load some of dlls. This is a screenshot from Fiddler:
Two of the red dlls are system and anoher one is the application dll. All the dlls are present in the wwwroot_framework_bin folder.
And this is what I see in the Chrome's Developer Console tab:

DLLs (and other filetypes that Blazor will request on your server) are filtered and not served by default.
Go inside the request filtering in IIS Manager and explicitly allow ".dll" file extensions.
You can also do this in the web.config file:
<system.webServer>
...
<security>
<requestFiltering>
<fileExtensions>
....
<add fileExtension=".dll" allowed="true" />
</fileExtensions>
</requestFiltering>
</security>
...
</system.webServer>
Some others you will surely need to allow: .js, .wasm and .json

Related

How to deploy a create-react-app using Azure DevOps?

I've spent the past 2 days trying to figure out how to deploy my web app using Azure DevOps but nothing shows up. I used FileZila to see if the files generated by the build is uploading and all the files are there under the wwwroot folder. I tried manually uploading the files using FileZilla too. At this point I'm getting really frustrated because I've tried everything I found online to deploy the app. DevOps works perfectly fine, the part that isn't working is my web app actually showing up when I go to the URL.
I followed all the tutorials I could find.
No idea why this is asking me to deploy my code when the code is clearly deployed :/
Failed to reproduce your issue,you could follow my working steps as below:
1.Import repository,I used the git url from this document:https://github.com/MicrosoftDocs/pipelines-javascript
2.Create Build Pipeline.
3.Run the Build process.
4.Release the project and choose Nodejs Web APP.
5.Choosing the azure web app service in your subscription.
6.Navigate to your project url.
7.My files in the /wwwroot directory.
And web.config file as below:
<?xml version="1.0" encoding="utf-8"?>
<!--
This configuration file is required if iisnode is used to run node processes behind
IIS or IIS Express. For more information, visit:
https://github.com/tjanczuk/iisnode/blob/master/src/samples/configuration/web.config
-->
<configuration>
<system.webServer>
<!-- Visit http://blogs.msdn.com/b/windowsazure/archive/2013/11/14/introduction-to-websockets-on-windows-azure-web-sites.aspx for more information on WebSocket support -->
<webSocket enabled="false" />
<handlers>
<!-- Indicates that the server.js file is a node.js site to be handled by the iisnode module -->
<add name="iisnode" path="server.js" verb="*" modules="iisnode"/>
</handlers>
<rewrite>
<rules>
<!-- Do not interfere with requests for node-inspector debugging -->
<rule name="NodeInspector" patternSyntax="ECMAScript" stopProcessing="true">
<match url="^server.js\/debug[\/]?" />
</rule>
<!-- First we consider whether the incoming URL matches a physical file in the /public folder -->
<rule name="StaticContent">
<action type="Rewrite" url="public{REQUEST_URI}"/>
</rule>
<!-- All other URLs are mapped to the node.js site entry point -->
<rule name="DynamicContent">
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="True"/>
</conditions>
<action type="Rewrite" url="server.js"/>
</rule>
</rules>
</rewrite>
<!-- 'bin' directory has no special meaning in node.js and apps can be placed in it -->
<security>
<requestFiltering>
<hiddenSegments>
<remove segment="bin"/>
</hiddenSegments>
</requestFiltering>
</security>
<!-- Make sure error responses are left untouched -->
<httpErrors existingResponse="PassThrough" />
<!--
You can control how Node is hosted within IIS using the following options:
* watchedFiles: semi-colon separated list of files that will be watched for changes to restart the server
* node_env: will be propagated to node as NODE_ENV environment variable
* debuggingEnabled - controls whether the built-in debugger is enabled
See https://github.com/tjanczuk/iisnode/blob/master/src/samples/configuration/web.config for a full list of options
-->
<!--<iisnode watchedFiles="web.config;*.js"/>-->
</system.webServer>
</configuration>
You could check any differences between your steps and mine.Any concern,please let me know.
The reason I was having this issue was that I was trying to deploy to a Linux web app in Azure.
Unfortunately, I couldn't find a way around getting the deployment to Linux working, but as soon as I switched the app to windows based app service plan the app worked instantly.
If you're deploying react app to azure app service linux instance via Azure devops, then be sure to add following 'Startup command' to the azure app service deployment task:
pm2 serve /home/site/wwwroot --no-daemon --spa
Azure App Service Linux uses Nginx for web server, and has pm2
installed. Know more about pm2 here ->
https://pm2.keymetrics.io/docs/usage/pm2-doc-single-page/
To automatically redirect all queries to the index.html use the --spa
option.
After devops run, your azure app service Configuration -> General Settings, will look like:

Kudu Debug Console access denied error when trying to save edits

I'm getting the following message when trying to save edits to rootweb.config:
Could not write to local resource 'D:\local\Config\rootweb.config' due
to error 'Access to the path 'D:\local\Config\rootweb.config' is
denied.'.
I'm trying to add the following to the file's default configuration after uploading my PHP project (my PHP project didn't include a web.config file):
<system.webServer>
<security>
<ipSecurity allowUnlisted="false" denyAction="NotFound">
<add allowed="true" ipAddress="<ip-address>" />
<!--add allowed="true" ipAddress="<ip-address>" /-->
</ipSecurity>
</security>
</system.webServer>
Is this file supposed to be editable, or do I need to include my own web.config?
Based on another Stack Overflow post I believe you just want to make a web.config and put it in the folder of your php app. You can not edit the configs in that folder you tried to access. You can modify the applicationHost.config via a site extension with a transform. I have experience doing that.
Windows Azure and web.config doesn't run with PHP web site
About Site extensions:
https://github.com/projectkudu/kudu/wiki/Azure-Site-Extensions

IIS Can't Serve .LDF or .MDF extensions

I'm trying to serve the extensions .ldf and .mdf and even though files of these types actually exist on the server, IIS keeps throwing 404 error whenever they are requested.
I've double checked IIS manager and both extensions are added MIME-types of application/octet_stream. Is there perhaps some other setting or place I've missed that needs something set?
Thanks for your help chaps.
Adding the following to web.config worked as suggested by Sergey Kornilov:
<security>
<requestFiltering>
<fileExtensions>
<remove fileExtension=".ldf" />
<remove fileExtension=".mdf" />
</fileExtensions>
</requestFiltering>
</security>

How to provide an .exe file as download on Windows Azure Website?

I am trying to publish a ClickOnce installer onto a website which is hosted on Windows Azure. The publishing process works as expected, nontheless the setup file is not available for download via HTTP. Obviously it is not possible to provide executables (.exe) and libraries (.dll) via HTTP. They are available via FTP, but HTTP requests yield a 'File not found' (404). After renaming the file to setup.txt, it can be downloaded, this doesn't really help, though. Can this be configured somehow?
Please try by adding the following in your web.config file:
<system.webServer>
<handlers>
<add name="Client exe" path="*.exe" verb="*" modules="StaticFileModule" resourceType="File" />
</handlers>
</system.webServer>
Source: http://mike-ward.net/blog/post/00631/how-to-configure-iis-7-to-allow-downloading-exe-files.
Add the allowed mime type to web config. Eg:
<system.webServer>
<staticContent>
<mimeMap fileExtension=".exe" mimeType="application/exe"/>
</staticContent>
</system.webServer>

ServiceStack with IIS 7.5

I installed Clean Windows Web Server 2008 R2 64-bit with IIS 7.5. I created .NET v4.0 application pool and Web Site in this pool, where I deployed my application with ServiceStack services.
I got this error message in web browser when I opened servicestack page.:
HTTP Error 500.21 - Internal Server Error
Handler "ServiceStack.Factory" has a bad module "ManagedPipelineHandler" in its module list.
My application is working in Visual studio hosted IIS server.
Can be problem with IIS 7.5 instalation and servicestack or it is some asp.net issue?
1) Ensure the following is in the web.config
<!-- Required for IIS 7.0 -->
<system.webServer>
<handlers>
<add path="*"
name="ServiceStack.Factory"
type="ServiceStack.WebHost.Endpoints.ServiceStackHttpHandlerFactory, ServiceStack"
verb="*" preCondition="integratedMode"
resourceType="Unspecified" allowPathInfo="true" />
</handlers>
</system.webServer>
copied from http://www.servicestack.net/ServiceStack.Hello/
2) If still not working then try running this command
%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_regiis.exe -i
See the article in comments that vaclamar found.

Resources