ASP .NET Core 2.0 Deployment (code not executing) - c#

I am very new to deploying applications to AWS, specifically Elastic Beanstalk through the "publish to AWS" feature built into visual studio 2017 after downloading the AWS toolkit.
My problem is that when I deploy my application which is a .NET core 2.0 empty application, it seems to deploy correctly (green health and no errors) and the "hello world" page is working when I navigate to the URL, but none of the functionality of the application is working.
I have a theory but I am not sure how to fix it.
When I run the code locally on visual studio 2017 everything works perfectly. When I deploy, I get no errors but code is not executed.
The application I made makes use of a main method which cascades all the other methods of the project, so I am assuming that my project is successfully deployed, but I don't have any commands, scripts or json files that states to start the main method.
How would you do that from visual studio/elastic beanstalk console?
Thanks for any help!

Related

ASP.NET Core app with Angular in Visual Studio - API does not run

I have been following this tutorial (Create an ASP.NET Core app with Angular in Visual Studio),
After following all the steps and running the solution at the end, it seems the Angular project is running successfully, however, the API doesn't run. I've tried hitting the API endpoint via postman and the breakpoints within Visual Studio are never hit.
From the angular app, within dev tools I see 504 Gateway Timeout when hitting https://localhost:4200/weatherforecast
Has anyone experienced this before? if so, how do you fix it?
I tired what is shown here, but the outcome is still the same.
Managed to resolve, seems I'm running the latest version of Nodejs which isn't support, ended up installing Node Version Manager and installing a version which was support, in my case v16.13.2
Once installed I then ran, nvm use 16.13.2, kicked off the project and voilĂ  it calls the backend api with no issues and displays the data :)
Hope it helps.

Changes to html /css not syncing to browser on Blazor application on mac

When I start a new Blazor server application, changes to HTML and CSS are not showing up unless I close the build and start a new build.
Im using VS for mac 2019, VS for mac 2022 (preview), and Jetbrains Rider. All are being run on a new M1 Mac book. All are having the same issue.
I can confirm I'm not having this problem when running an MVC application.
Tried running with both .net 5 and .net 6
Adding following to my Startup.cs file from other suggestions:
services.AddRazorPages().AddRazorRuntimeCompilation();
I had to run the project using IISExpress to see html changes to .razor files. Changes to .cshtml files can be seen on browser refresh without running IISExpress though.

Installing ASP .NET Core service to IIS using Visual Studio Installer Projects

I have a ASP .NET Core 3.1 application which is hosted as a windows service using IHostBuilder.UseWindowsService call. I am preparing a setup project using Visual Studio Installer Projects Extensions. The project is created as Web Setup project type so that the installer dialog already presents to the user selection of web page and application pool on IIS.
The problem I'm facing is that the assemblies are successfully installed in given folder on IIS, but the ApplicationService.deps.json is not installed. Without this file the application does not start successfully. As far as I have checked the file is created as part of the build in bin\x64\Release\netcoreapp3.1\ but is apparently not included by the Setup project.
I've played around also with Setup project's property PublishProfilePath by specify the profile that I generated when manually trying to publish from Visual Studio to IIS:
However, this produces even stranger results. The application is deployed to the IIS already when I build the Setup project! Then when check the newly created msi, it's size is really small and in fact does not install anything (completes successfully though).
Any help would be highly appreciated.
I managed to solve the problem, though I'm not sure if that's the optimal solution. In the setup project, you can include as part of the output also individual files. If I add the ApplicationService.deps.json it is marked with a relative path in the setup project itself. This means that once setup project is being build, the ApplicationService project is anyway built first as it's the primary output of setup project. At that point `ApplicationService.deps.json' is present in the Release folder. Then as msi is being created it's included as part of the output.
It works, but I would prefer that the setup project would include that file automatically.

How to I run a C# Framework API

The question may be a bit idiotic, but I can't find the answer on internet or Microsoft tutorials.
The goal of my project is to build an API to has to run locally on a Windows computer. My API mustn't have an interface or things like that, so I deleted every views and other files like bootstrap or jQuery. Then I call it with Unity.
The API works well, but I always run it with Visual Studio 2019. Is there something like a .exe or a command line to start my API ?
Thank you for your answers ! :)
PS : Yeah I know that an API running locally is quite useless, but with Unity it's really complicated to use things like pipes...
You can host your WebApi application in IIS, so you don't need to run it with Visual Studio.
If you are developing another project, you can ask Visual Studio to run multiple projects during a debugging session. While debuging your unity application, Visual Studio will run your API in the background:
https://learn.microsoft.com/en-us/visualstudio/ide/how-to-set-multiple-startup-projects?view=vs-2019
Otherwise, you may self host your asp.net webapi application.
There are official Microsoft tutorials on that:
For WebAPI 1:
https://learn.microsoft.com/en-us/aspnet/web-api/overview/older-versions/self-host-a-web-api
For WebAPI 2: https://learn.microsoft.com/en-us/aspnet/web-api/overview/hosting-aspnet-web-api/use-owin-to-self-host-web-api

Code made on VS2017 for mac don't work on VS2017 for Windows

I'm not a developer but I needed to code a simple web page for a POC.
For that I used VS2017 for mac to make a MVC project and all is fine when I run it on "my machine" (yeah I know it a common issue :P), I mean I can build the solution and open the web page, this page is used to create/register an user at AWS Cognito.
But when I run this same solution in a windows machine with Visual Studio 2017, the project builds without errors the web page opens but I can't make the API calls to aws cognito, this machine has open access to internet, so it's not a network problem.
I think it can be a software problem, I'm using C# and .NET 4.5 + the AWS SDKs referent to the project.
Anyone has an idea?
Thanks in advance

Categories