Blazor WebAssembly caching on IIS - iis

I have migrated my Blazor project from net5 to net6.
However, I get the following error when launching the website:
Uncaught (in promise) error: could not find class: Microsoft.AspNetCore.Components.WebAssembly.Hosting:EntrypointInvoker in assembly Microsoft.AspNetCore.Components.WebAssembly
I have learned from https://github.com/dotnet/aspnetcore/issues/38436 that I might have an issue with caching the blazor.webassembly.js in the browser.
The file blazor.webassembly.js should be served without caching it (cache-control: no-cache).
However, the file is not served with the corresponding header:
It is not a blazor webassembly .NET Core hosted, but a simple static website, hosted with IIS. Is there a specific setting on IIS or elsewhere that I am missing?

Related

Deploy angular 4 App in IIS

I have a multi-tenant Angular 4 and .Net core 2.0 application.
I have hosted .Net core API in IIS with deployment time debugging and for that I have followed this link.
https://learn.microsoft.com/en-us/aspnet/core/publishing/development-time-iis-support
With this configuration in IIS, I can access my API any time and if I want to debugg it, I can run it in VS.
Now, Is it possible to run Angular app directly with IIS. I mean is there any way that npm start will directly open app in specific IIS url like app.myapp.local, and not at localhost:4200
what I have did so far?
I have added one folder in wwwroot/myapp, and I have pointed it to Default web site in IIS.
then, I am building my app with ng build, copying all content of dist folder to wwwroot/myapp.
Is there any proper way in Angular, to handle this kind of scenario?
this question is not same as this Deploy angular application on IIS
because as I specified, I want to start my app in debugging mode at specific URL without building it, So please don't add it in duplicate without understanding question.

Can you host a ServiceStack Web App in IIS?

I have made a ServiceStack Web App that uses a custom AppHost from a plugin (similar to the example https://github.com/NetCoreWebApps/WebApp/tree/master/src/apps/chat). I can run it on macOS with the dotnet command as per the examples.
Can I host my Service Stack Web App on IIS? What approach should I take? Reverse-proxying Kestrel like this https://learn.microsoft.com/en-us/aspnet/core/publishing/iis?tabs=aspnetcore2x
or will I need to have different AppHost/Startup code for the two hosting situations?
Or maybe there's a fundamental reason why it will never work?
WebApp is a standard .NET Core 2.0 App so you'll be able to host it as you would any other .NET Core App. Normally reverse proxies don't require anything except the internal url where the request is proxied to, but it looks like IIS wants you to explicitly call .UseIISIntegration() which is an issue that may have prevented the existing WebApp binary as it didn't call .NET Core 2.0 WebHost.CreateDefaultBuilder(args) which among other things would turn on IISIntegration when the .NET Core App is hosted in IIS/Windows which is now being done from this commit.
You can find the updated Web App binaries with this change in the /web folder of the https://github.com/NetCoreWebApps/Chat project.

ReastJS, Node, and IIS

I have been following a tutorial from Cory House on Pluralsight about React, Redux, webpack, babel, and a bunch of other support libraries. I am using Visual Studio Code on a windows OS. I have completed the tutorial, which includes a build process that outputs a bundled js file to a dist folder. The build process also runs the app to verify the build is correct (which it is). I then tried to copy the contents up to an IIS server and run it there. However, when I try to access the web site, the index page comes up blank. I verified the bundled js file is called (returns 200 status). That left me wondering if there is an extra step I need to do to transfer an app created using Node to one that can run on IIS.
I should clarify I added a web.config file to the site.
Any help is appreciated
Edit: Here are two errors I am getting on when rendering the page. One of the errors (#2) appears to be a web pack module:
Error 1
Error 2
In error 2, "Attributes" is undefined
I figured it out partially. It had to do with react-router and my routing. When developing and running it locally, it was running at the root of local host:
http://localhost
When I moved it to the IIS server, I had to create an app under the default web site, which changed the apps url to:
http://localhost/ReactJS
That caused my routing to fail and loaded a blank page. However, even though the home page loads now since fixing the routing, it is still not working as I can't navigate to the other views, but at least I have narrowed it down.

ASP.NET Core dynamic assembly (dll) mvc (attribute) routing

I'm using the AssemblyLoaderContext in ASP.NET Core 1.1 to load a dll in my plugin folder in my MVC main application with the 'LoadAssemblyFromPath' function. However, I'd like to the attribute routing of my plugin dll's controller to work in my main application. For this I should be able to clear and rebuild the MVC routing. How is this possible to do? It used to be doable in MVC 4-5 using GlobalConfiguration, but as I read on some blogs, it was not a best practice and so the GlobalConfiguration is removed from ASP.NET Core.
So, how can I rebuild the MVC routes, not from the startup class, because I don't want to restart my web application?
I'm aiming for an experience like Wordpress and Drupal, where you upload the dll in this case to the server and in the UI, press activate to load this plugin.

ASP.NET RC1 Update 1 in Azure Web Site

I have my startup developed in ASP.NET Core RC1 and published in Azure like a web site.
Sometimes I don't know why, the web app is down. I don't know what exactly happens, but I have an error in GCI like this:
The specified CGI application encountered an error and the server
terminated the process.
I have about 100K users, but it happens in hours that I don't have a lot of users using the web.
Here you have some screenshot about the errors:
I have created an API in a version of ASP.NET 4.5 to upload images to the platform (I know about the error of uploading files in Kestrel) and I'm in a point where I don't know what happens.
I'm using Application Insight in my platform, and I have received an alert, about the service:
90% of all the failed requests had this exception: Exception
method: System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess
Exception type: Microsoft.AspNet.Server.Kestrel.Networking.UvException
I am totally frustrated about how to solve the error. My web app was totally fine when I was working in ASP.NET 4.5 in AWS, but now, I have a lot of problems...
What can I do? Any idea or help? Thanks.

Resources