I have an issues running net.core 2.0 app inside of vscode. I installed angular cli project, then used dotnet new webapi to install net.core 2.0 project.
Structure is like this:
When I use command dotnet run, I can see kestrel is running:
PS D:\CodePlayground\my-dream-app> dotnet run Using launch settings
from D:\CodePlayground\my-dream-app\Properties\launchSettings.json...
Hosting environment: Development Content root path:
D:\CodePlayground\my-dream-app Now listening on:
http://localhost:28009
But when I open a page in browser I get this:
It works in visual studio 2017, iis or self hosted.
You need to specify your controller like http://localhost:28009/yourcontrollername or you have to config which action for empty route
Related
In a project im working on, we are upgrading our Episerver CMS website from CMS11 (.net framework) to Optimizely CMS12 (.Net core) for a customer.
To run IIS Express using CLI (to not have the need to run the application from VS/Rider) and start NPM develop, we have written this .bat script.
#ECHO OFF
ECHO starting site
start iisexpress /config:.vs\*PROJECT_NAME*\config\applicationhost.config /siteid:2
cd %~dp0\src\Site
start npm run develop
As a result of upgrading from framework to core, we are now configuring the project through appsettings.json instead of applicationhost.config (XML), where we define which site bindings to be launched from (siteid:2).
I've been looking for a way to do the same through bindings in .json, with no luck. Does anyone have any ideas for a solution?
I would recommend using Kestrel instead of IIS Express locally and simply start the site with: dotnet run
You can also use dotnet watch to automatically rebuild/restart the site when source code files change.
https://learn.microsoft.com/en-us/aspnet/core/getting-started/?view=aspnetcore-7.0&tabs=windows#run-the-app
I have made a simple application in net core 3.1 using mvc and razor pages and I want to deploy it in windows 10. I am working on Ubuntu 20.04 with Visual Studio Code. I have deployed the application as a Self-contained deployment (SCD) running
dotnet publish -c Release -r win10-x64 --self-contained True
Then, copy the folder to a Windows machine. If I double click the .exe, everything runs perfect. But when I create a windows service with
sc create RazService binPath= %~dp0Raz.exe
sc start RazService
sc config RazService start=auto
When running the app, it enters the home page. But when I navigate to another page that requires access to the database (SQLite), it cannot find it.
I tried to change the keys-values in the regedit to change the root directory but it didn't work.
So What am i missing here?
Thanks.
I have built a sample ASP.NET Core MVC app, the project was setup from the command line. I was able to run the app using dotnet watch run command, but I could not start the app from Visual Studio by hitting the F5 key.
Why is this?
I have installed a CA certificate from commands (one to remove existing and other to add new)
dotnet dev-certs https --clean
dotnet dev-certs https --trust
Could this be causing the problem, if so how do I fix it? (I need to keep the new certificate as well)
In the solutions folder, there are folders for the ClientApp (Angular) and the server app (ASP.NET Core MVC).
When I hit F5, I get an error (the same error for both ports 5000 and 5001):
I have problem with publishing under IIS. i have been trying to automate publishing web app to the IIS by following cmd dotnet publish App.csproj -c -o C:\inetpub\wwwroot\App.Web -c release, but it just added it as folder, how to publish it as a Web Application, is it possible?
you will need to convert your folder to an application.
To do so, just right click on it, and select "convert to application"
After that, as you're publishing a .netCore application, you will have to configure the application pool running that app, and set "Framework version" to unmaged. (and leave
the pipeline to integrated)
more information on hosting .NetCore on IIS
This is a one step configuration.
All you next publish should work fine.
Some more explanations :
.NetCore is platform agnostics, so it can't know you're deploying on IIS.
When you deploy with legacy .net (4.xx) Visual studio has an IIS target for deployment, and did all the work.
With .net core, as it can also be run under linux, mac, etc.. the IIS specificities have been removed.
So, I've been trying to publish my Core App to local IIS server but whatever I do it just doesn't want to run.
What I do is find the project in windows explorer and open a command window there, and write the following:
dotnet publish --framework netcoreapp1.0 --output "C:/ReleaseWebsite" --configuration Release
Which well executes without any errors, and finally says that it published the project correctly.
After that I go to IIS and Add New Website, set it to port 80 or 8080, I even tried with 8088, and after set the path to the published files, I edit the Application Pool and set it to No Managed Code. Start the website but all I get it 500 error An error occurred while starting the application.
If I go manually to the published files and open GST.Web.exe it starts without any issues, and rusn on port 5000 and I can access it without any problems. But I want to run it in IIS. Any help?
Refer Publishing to IIS article.
I think you must have done all the steps from this article except installing .NET Core Windows Server Hosting bundle on the server.
Install the .NET Core Windows Server Hosting bundle on the server.
This bundle will install the .NET Core Runtime, .NET Core Library, and the ASP.NET Core Module. The module creates the reverse-proxy between IIS and the Kestrel server.
See if this helps.