Deploying ASP.Net Web Forms project to Fedora 24 - c#

Here is my current setup:
My Local Computer: This is where I created and programmed my ASP.Net WebForms project with Cloudflare Flexible SSL enabled using visual studio 2015 professional on Windows 10. I also have the team explorer enabled meaning my project is synced to Github and all of my files are also stored there in my own repository.
My Server Computer: Running Fedora 24, I've installed the dotnet CLI (a.k.a .Net Core), apache (httpd), nginx, and Mono for ASP.Net. I want to deploy/publish and host my webforms project on this computer in the default web directory (/var/www/html/mysite/)
The problem is, the dotnet cli relies on a project.json and is not compatible with WebForms. .Net Core is basically not an option. When I use mod_mono, I get an Error 500 (see below) if I connect to https://localhost:9000/ while running the server using the command xsp4 --port 9000. I can't use xsp4 --port 80 or xsp4 --port 443 because then it claims Address is already in use even though httpd is the only process listening on those ports. Note that I can sucessfully build the project using the xbuild command.
How can I take my project from github or my local computer and deploy it on to my server computer? Am I missing something? Here is my virtual hosts configuration for reference: httpd.conf. I typically get no errors when starting httpd.service.
EDIT:
I've also used nginx with fastcgi-mono-server4 with this configuration instead with nginx, which I got straight from here, but still no luck. I usually get this Error 500: other times I can get other types of Error 500. If there is a solution that works with either apache or nginx, please let me know.

Your code is Full NET and not even NET Core and trying to deploy it to Mono Framework. This may not work, Convert your project into Mono or NET Core and retry.

Related

Running IIS Express from the Command Line .Net Core

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

How to host a DotNet Core 6.0 WebAPI project on IIS using CLI?

I am trying to host my webapi project locally using IIS server. I am using VS Code to create my webapi using .NET 6.0.
Here are the steps I took:
I ran dotnet publish --configuration Release. This created files under 'bin\Release\net6.0'.
I downloaded the ASP.NET Core 6.0 Runtime (v6.0.2) - Windows Hosting Bundle.
Next, I created a website in IIS using the Physical Path as 'bin\Release\net6.0' and set the port to 8084.
Now when I try to browse to the path, localhost/8084/api/users it returns 500 Internal Server Error. What am I missing?
Settings for IIS
I was able to find the solution go this, thanks to #gunr2171.
The issue was with using user-secrets. When using user-secrets, IIS is not able to find the secrets.json file. This caused the application at IIS to fail with null reference(Found this through Event Viewer).
A solution that I found to this is - for development purpose, we can copy paste the secrets.json file to the physical path being used by IIS to host. This lets us continue hosting through IIS without issues.
You need to install this bundle, then try again :). Check your .net core version

Server Error 403 Forbidden on Blazor server app published to Linux hosting

I want to deploy a Hello World Blazor Server App created with the Blazor App Source Template 3.1.11 in VS2019 C#
The app is created in VS2019 on Windows 10
The docs show how to create the /bin/Release/{TARGET FRAMEWORK}/publish folder
I copied the files here to the domain folder in my hosting package, but do not know the next step.
web.config is for windows hosting.
What do I need to do for Linux?
At the moment I get a 403 error if I go to the site.
I can publish the app to a windows hosted site.
[Update]
It turns out that the Linux server does not have DotNet installed.
By default, dotnet publish publishes the entire application for running on the current operating system. When that does not match where you intend to run the application you can specify the runtime to publish for with -r|--runtime.
Something like this should work: dotnet publish -r linux-x64
A 403 error would lie somewhere in the IIS/web server configuration. Look at the config file or the IIS settings.

MVC 5.0 500 - Internal server error

I have created an MVC 5 website using Visual Studio 2015 on a Windows Server 2016 Machine.
I build and run the application from VS and it works great.
I published it locally, pointed IIS to the root folder.
The Application Pool is set to .Net CLR Version v4.0.30319.
When I try to access the page on the web, I get a generic error
500 - Internal server error.
There is a problem with the resource you are looking for, and it cannot be displayed.
There is nothing in the IIS logs.
Not sure how to get this error so I can see it...or if it is a more basic issue. Any ideas on the best way to proceed?
To configure within Microsoft Server 2016, do the following:
Make sure you've installed the feature set for Web Server & Hosting are installed.
If those are installed, create a directory such as: "C:\Program Files\Sample"
Publish your application to the directory
Open Internet Information System
Disable Default Site
Create a New Site
Create a Site Name "Sample" (Take note of the Application Pool Name)
Now link "C:\Program Files\Sample" in Physical Path
For now leave the binding defaulted, this will trigger wildcard
Uncheck Start Website Immediately
Navigate back to "C:\Program Files\Sample" (Accessible through IIS also)
Right-Click and go to Permissions
Choose add new user
Type in "IIS AppPool\Sample"
Choose access your application will require.
Apply those changes, then navigate and start your web-site.
If that doesn't work, you can check the following:
Application Pool:
Sample should of defaulted to integrated and 4.0, if not change it. If your utilizing .Net Core application, you want it to be Unmanaged Code
Programs and Features:
Make sure that you have .Net 3.5, 3.0, 2.0 enabled.
Hostable Web Core & Internet Information System (Under Web Server) for you.
World Wide Web Services Enabled, with the proper Application Development Features.
Dependencies:
You may have to install https://www.microsoft.com/download/details.aspx?id=53840
If you have Core, you'll need: https://aka.ms/dotnetcore-2-windowshosting

Unable to run ASP.NET Core rc2 in IIS

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.

Categories