MVC controller blocking issues when published in IIS hosting server - c#

We have a web application developed in MVC 4 using Razor (.Net framework 4) and we have another web application developed using .net framework 2.0 without MVC.
We are sharing form authentication using machine key and we are sharing sessions between both application by changing the application name in global.asax.
When we run our project in local environment and in local IIS aswell both of them is working normally and all the multiple requests are processed and completed as usual.
But when we publish our project in IIS hosting server form authentication, session sharing and everything is working normally for a while but after sending multiple requests the MVC doesnot seem to process the request and its blocked so we are not able to send new requests.
Can any one please help us resolve this issue and explain where actually the problem is arising?
Thank you

Related

Identity Server4 Authentication Web API failing

I have an application that is broken up into 3 tiers. I have Identity Server 4, a Web API and a C# Razor/MVC (.NET 5) application deployed separately all on the same domain. There is a reverse proxy setup to route requests for each to their own server. So www.somedomain.com/IdentityServer, www.somedomain.com/MVC and www.somedomain.com/api.
I am using Identity Server to authenticate and we can successfully do so without an issue. However when I try to call one of the API endpoints (which are decorated with the [Authorize] attribute) from the C# Razor/MVC application I get a 'Authorization failed! Given Policy has not been granted' error.
When I run the same endpoint that the C# Razor app consumes using swagger/postman (after I've been authorized and get a token) I have no problem returning returning valid results, so the issue seems to be related my authentication between the Razor app and Web API.
When I run these 3 tiers locally in Visual Studio (all with localhost but a different port #), it all works just fine.
Any thoughts or additional information needed to give me some ideas of what the issue may be? Thank you so much in advance for your help.

SignalR in ASP.Net Core self host

Is it still possible to self-host a SignalR Hub (server) without using IIS / Kestrel?
MS does not have any information as though if it is still possible (using asp.net core migration) to achieve this.
My use case for this would be to be able to deploy both the client and the server to local machines and then be able to easily switch to remote servers at a later stage. Ideally, the client would host the server for now.
ASP.NET Core implies using Kestrel as its web server. That means that in order to host a SignalR hub (server), you will need to use Kestrel and basically build an ASP.NET Core application.
You will however not need to use IIS or some other web server to host the application. Kestrel on its own already is a full web server, so you can use it directly without needing anything else.
The ASP.NET Core application hosting your SignalR hub also doesn’t need to do any other web-stuff. It would be totally fine for it to just contain the single hub and host just that. So you usually don’t need to worry about it too much.
So, to address your use case: Yes, you could have a separate ASP.NET Core application hosting the hub and start that directly on the client and the client could connect to it. And then later you could have another ASP.NET Core application hosting the hub running elsewhere and reconfigure the client to use that one then.
Yes, you can self host .NET Core SignalR.
A SignalR server is usually hosted in an ASP.NET application in IIS, but it can also be self-hosted (such as in a console application or Windows service) using the self-host library.
You can read more about it here.

Global Key Hook in ASP.Net Core using C#/.Net Core 2.2

Environment
ASP.NET Core Application with Kestrel hosted as Windows Service using .Net Core 2.2
Angualar Application which is delivered through the ASP.NET application
Web API for communicating between the ASP.NET and Angular application
Everything is running on one Windows PC. The Angular application will always be only available on localhost
Use Case
A user makes a screenshot of a WPF application also running on the same PC using the print key. The ASP.NET application needs now a trigger, that a screenshot was made so it can be send to the angular application.
Solution approach
I thought that I would just listen with a global hook for the print key and then get the image from the clipboard. I've tried using the low level Windows API and different Nuget packages (for example this one). Either nothing happened or the application froze.
Question
Is there a way listening globally for the key press of the print key in .Net Core 2.2 application or is there another approach I can listen for new screenshots made by the user?

ASP.NET Core 2.0 Web API IIS Hosting and Debugging

I have a ASP.NET Core 2 Web API with the Angular 4 front end SPA application. It was created using clean Core 2 Web API template in VS2017 and angular-cli for the front-end using VSCode. Currently I can successfully run my prototype using either IIS Express WebAPI or self-hosted. I can successfully deploy to IIS using steps simmilar to these: https://learn.microsoft.com/en-us/aspnet/core/publishing/iis?tabs=aspnetcore2x. However, I can't figure out how to attach to the IIS process to be able to step through the code as I used to do with regular old Web API or MVC app hosted in IIS.
I'm coming from traditional Web API and Angular1 environment. Both ends were deployed to IIS and it was a simple process to attach to IIS for troubleshooting. So, maybe it's a stupid question, but I can't seem to find good resource on how to approach production deployment of such Core 2 WebAPI + Angular 2 SPA app. What are the best practices? IIS for Web API and npm for client? Can someone maybe point me to tutorial on how to do that and how to debug/troubleshoot with IIS? Are there a better ways to deploy/host it, maybe my approach is wrong and IIS not needed?
If any pictures, code, setup is needed I'll gladly add it to the question. I just don't know what I can provide at the moment. Any help, advise, link will be much appreciated!
Not 100% sure if this is what you're after, but check out this blog-post:
https://blogs.msdn.microsoft.com/webdev/2017/07/13/development-time-iis-support-for-asp-net-core-applications/
Note: Make sure you select the new launch profile ("IIS") in the main window, before starting a debug session!

Auto update asp.net web application from remote server

I have several clients who are using web application hosted in their local IIS server at different locations. Currently all are using version 1.0.
I published the new version of the application say version 1.1, zipped and host in http server at location X.
My application can check if new version is available or not. Now what can be done so that v1.0 at client side can be replaced with new version i.e. 1.1. I want the v1.0 running at client side, automatically (of course with user permission) downloads the v1.1 from http server using internet, extracts the file and host itself in local IIS server.
Is their any method like ClickOnce for web application? I have build the application using asp.net C#. Any 3rd party application or C# code sample would be useful.
I came across your question, if you want to make web apps that are self updating, you can check a solution here http://haacked.com/archive/2011/01/15/building-a-self-updating-site-using-nuget.aspx/, as for updating database, you can add a bootsrapper class that if you are using nHibernate use SchemaUpdate(config).Execute(true, true); that you call on site/index to ensure that the schema is updating. hope thats help

Categories

Resources