Failed to Listen on the Given Port .net core 2.0 IIS - iis

I am trying to publish a .netcore 2.0 application to a remote web server and host it using IIS. I have a custom domain setup and want to run it as www.mysub.mydomain.com. It is a web api application.
I have published the app to the server and when I run dotnet on the project manually, it runs. It runs off of localhost:5000 when I do this, and when I navigate to it on the server it works properly.
The problem comes when I try to run it via IIS after binding www.mysub.mydomain.com to the location. I get a 502.5 Process Failure error in my browser.
When I check the Event Viewer, I see that it says "created process with commandline 'dotnet .\myproj.dll' but failed to listen on the given port '21159'"
Any ideas?

Related

HTTP Error 500.30 - ASP.NET Core app failed to start - azure

I am running a blazor wasm hosted project 6.0 and in development it perfectly works, but when I deploy/publish it to azure app, i get the following error
HTTP Error 500.30 - ASP.NET Core app failed to start
Common solutions to this issue:
The app failed to start
The app started but then stopped
The app started but threw an exception during startup
Troubleshooting steps:
Check the system event log for error messages
Enable logging the application process' stdout messages
Attach a debugger to the application process and inspect
For more information visit: https://go.microsoft.com/fwlink/?LinkID=2028265
How will I debug the issue? It says system event log, The application is hosted in azure. is there any mechanism to know the exact cause of the error?
to see the logs and analyse the exact cause of error when hosted in azure I did the following:
https://<yoursitename>.scm.azurewebsites.net/api/dump
this will give you an errorlog folder and you can analyse the exact cause of error.

My Server Side Blazor app's Counter isn't incrementing when deployed to Azure

I newed up a server side Blazor project (formerly Razor Components) via dotnet new razorcomponents -o MySampleApp. It works as expected on my machine, when when I right click and attempt to publish to Azure, it fails with a
HTTP Error 503. The service is unavailable.
I solved this by using the "Self-Contained" Deployment Mode, which gets me to the expected Blazor example home page. The weather forecast page works, but the counter page fails to increment. How can I fix this?
I needed to turn on websockets. Duh.
I found it under portal.azure.com > MySampleApp app service > Configuration > General Settings > Web sockets.
Also, apparently I can install the ASP.NET Core 3.0 Runtime in Extensions, which means I can go back to "Framework-Dependent" as a Deployment Mode. This video was a great help: https://www.youtube.com/watch?v=GfazTDXH6JA

Issues using Chrome-Pdf recipie on IIS

I am using the jsreport nuget packages in an asp.net core application. I am able to generate my pdf reports on my local machine however I run into an issue when I try to generate reports with the asp.net core application running in IIS. Whenever I attempt to run a report, it ultimately times out and gives me the following error:
Error rendering report: instance has been daemonized and initialized successfully (pid: 2480)A critical error occurred while trying to execute the render command: Timeout Error: pdf generation not completed after 40000ms
Some information about my setup:
The app is being hosed in IIS on a Server2008R2 machine
The IIS app is running under the Network Authority user.
I have given the application pool full permissions on the jsreport
folder deployed with the ASP.Net Core application.
I have give the application pool full permissions on the jsreport
folder in C:\Windows\Temp
Here is what I have been able to verify so far:
I can navigate to the jsreport folder in the deployed asp.net core
application, run jsreport start from the command line and enter
jsreport studio. From there I can run my reports with sample data
sizes comparable to what I would expect at runtime, and they export
to PDF just fine.
I can successfully make a request to the IIS hosted asp.net core application to render a plain HTML report.
The reports run just fine when being hosted on my local machine, outside of IIS.
It seems like there is some kind of issue with IIS accessing Chrome and doing the pdf conversion. Are there any additional steps I need to take to get chrome-pdf conversion working when hosting with IIS?

How to run ASP.NET Core site under IIS

I've studied the docs on how to do this but am still not understanding:
I've published my site from Visual Studio and can run the site from the command prompt using the command:
dotnet MyDotnetCoreApp.dll
That tells me the app started on http://localhost:5000 and I can browse to it just fine.
But how do I get IIS to start the app though so that I can go to the normal port 80? The web.config has the correct entry:
<aspNetCore processPath="dotnet" arguments=".\MyDotnetCoreApp.dll" .... />
All I get is 500 An error occurred while starting the application.
Must be missing some simple step. Thanks in advance.
Actually in your case you are not running using IIS, but using Kestrel HTTP Server.
You can read about Kestrel hosting configuration (and find how to change listening port) in this SO answer.
In case if you need to run under IIS (that is still publish option #1 on Windows, despite IIS is acting now merely as a reverse proxy and the application itself runs as a separate process using the Kestrel HTTP server), you may find Running ASP.Net Core applications with IIS article very useful, as it explains not just how to make ASP.NET Core works with IIS, but also "what’s really happening, why it’s happening and how the blocks fit together"

msdeploy mvc to Windows7 getting ERROR_DESTINATION_NOT_REACHABLE and 404

I'm trying to do msdeploy of a MVC app to a windows7 box, running on command-line. And kept getting this error:
Error Code: ERROR_DESTINATION_NOT_REACHABLE
More Information: Could not connect to the destination computer ("192.168.xxx.xxx"
). On the destination computer, make sure that Web Deploy is installed and that
the required process ("The Web Management Service") is started.
Error: The remote server returned an error: (404) Not Found.
Error count: 1.
I've verified both Wmsvc (seems this is being used) and MsDepSvc are running. And firewall are disabled. In the browser when I visit https://192.168.xxx.xxx:8172/msdeploy.axd, I got a Server Error 404, seems a bit further than where the command-line stopped.
Most of instructions on setting up IIS7 and Web deployment I could find online is for MS Servers. Both my local machine and the Windows7 machine has the same version of Msdeploy installed.
I had exactly the same issue with a VM on Azure, and the solution was to enable first the IIS Management Service and then install Web Deploy (I used Web Platform Installer). Seems that the installation order matters. You can find a blog entry I wrote about this here http://davidjrh.intelequia.com/2012/10/configurando-web-platform-installer-y.html
For non-server operating systems (i.e. Windows 7) the Web Deploy publish via Web Management Service is not supported. Instead you will have to use the Remote Agent Service, this is an admin only publishing service. You can find more info at http://technet.microsoft.com/en-us/library/dd569059(v=WS.10).aspx.
I had the same issue using MSDeploy to deploy my web application to remote IIS 7.5 web server running windows 7. I have just figured out how to fix the problem today after reading Sayed's post, so I wanna post my solution here for anyone who would run into this problem like me. Try this:
Enable IIS Management Service (in control panel >> add or remove features >> add or remove windows features)
Install Web Deploy (http://www.iis.net/downloads/microsoft/web-deploy)
Open cmd with Administrative privilege, type “net start msdepsvc” to start the “Web Deploy Agent Service”.
Check this link in your browser: http://serveraddress/MsDeployAgentService/, if it prompts for username and password, MsDeployAgentService is running on server, go to the next step.
In VS, type in http://serveraddress/MsDeployAgentService/ in Service URL while creating publish, instead of https://serveraddress:8172/MsDeploy.axd, and click test connection. It should be ok now.
After checking the Management Service and Web Deploy 3.0 were correctly installed, I found that (from VS2012 at least) the Service URL seems to matter here too, attempting to publish to any of the following did not work for me:
FQDN (localmachine.domain.local)
Domain IP Address (172.22.xxx.xxx)
Loop-back IP (127.0.0.1)
Whereas the following DID work:
localhost
NetBIOS name (localmachine)

Resources