Hosting API With Ubuntu - c#

I have used Ubuntu to host websites in php before, but now I have created a C# VS API that I clicked my project and went to Publish and copied the files over to my /var/www/ directory thinking that it would be that simple for my api to launch. (of course I have apache installed and configured). However, when I navigate to the IP address instead of getting my API I generated I get a Index of / page showing the contents of the directory.
Is there a special setting needed in Ubuntu to be able to run an API? Did I not correctly generate the needed files from Visual Studio 2017?

Related

Why is my .NET WEB API on IIS listing physical files and not my Website

I am developing a .NET (not core) WEB API.
When I run it on mode debug in Visual Studio, and try to call the GET method of my API via Browser or Postman, it works fine!
But I am trying to publish it on my local IIS.
I published it via Visual Studio on a local folder. Created a website on IIS and made it point to the local folder.
When I try to open it on Browser, it just lists the files that are in the local folder. It doesnt execute my webAPI correctly.
Any insight on that?

How can I run an mvc app on windows server?

I'm really new at this, never hosted an app before, everything I've done so far has been locally.
I have a windows server 2008 sp1 running at work, with IIS installed. I access to it via remote desktop, and I need to be able to deploy my app, first locally on the server, so computers that can access it (through LAN) are able to use it.
Right now, if I create a folder and put some data in it, with an html file, and go to "localhost" in a browser, I can see the rendered html file.
The version installed is IIS 7.0, and my app is uses the MVC pattern, and .net framework 4.6.
If on my windows 10 PC I start my app (vs 2017) I can see it on my browser.
I want to be able to do what I do in my PC but on the server. How can I do this?
Update:
I tried Publishing the app through vs but that is on my windows pc and getting a lot of errors. What I know so far is that a guy from Networks gets the app by the developers and they publish it, but I don't know what kind of files does he need.
I followed tutorials but I just can't apply them.
As I said earlier, I have visual studio installed on my w10 PC, and tried publishing through that app to the ip where the server is, getting a lot of errors.
I don't know what to do, I'm really trying a lot of different things, but I don't even know how the app is supposed to look to be run in any way that is not how I run it in visual studio.
UPDATE:
I'm getting this error when I try to publish locally
Here is the Outline of what we need as per OPs requirement
In VS publish the App to a folder
Sort out the server prerequisites:
Turning Windows Feature On or Off for ASP.NET, ISAPI filters, ISAPI extensions, NET extensibility
Server should have .NetFramework installed
Copy the published folder to the Server
Configure IIS manager to add a new site and set physical path to published folder

How to Deploy ASP.NET Core MVC with Vs Code on a Mac?

I'm developing a ASP.NET Core app with VS Code on a Mac, and it is time to publish.
I ordered a server (Not azure), registered the domain, but I'm not quite sure about how to deploy this to my Host.
The Host sended to me a Publish Profile, can I deploy my application with VS Code on a Mac ?
Or should I publish in a local folder then send to the host via FTP?
Thanks in advance.
I came thought the Windows Side of the force, and with the publish profile in Visual Studio for Windows, it just works...Now, on a Mac is really confusing.
I`m not using Visual Studio for Mac because its too slow (Macbook air).
I found my solution.
After developing the site. I should run a
dotnet publish
and then, get the publish folder that was created in the process and upload to my host via FTP (inside the wwwroot folder).
That's it.

Published .NET app is looking for API in source folder

I'm new to API development and have created a Web API app that works fine locally (Visual Studio / IIS Express). When I publish and deploy to IIS 8.5, the HTML pages work fine, but when I make an ajax call to my APIs, I get a 500 error. It somehow seems to be looking at my source code folder on my c: drive!, instead of the dll.
I'm guessing I botched something in the VS Publish setting, or in my API routing in WebApiConfig.
Any idea on why it's looking in my source directory?
From what I can understand, is that your API is expecting custom header as part of your request. Please use PostMan or any other REST API Client to test your API by adding required headers. If you build and publish in release mode you will not find your local source code folder path.

How to Upload .Net Website to Hosting for it to work?

To learn more about .Net I created a website but now I want to learn how to Host it, in PHP I would just upload the files to the host and check everything how do I do this with a .Net website?
I have 2 Databases, Controllers, and Views.
I done some research and people said to just upload the files from the bin folder which I tried but it did not work, also tried just tried uploading the DLL files with no success.
Also tried uploading all the files from the project folder but it did not work.
Found a tutorial which right click the project and publish it so I tried publishing it to a folder and then uploading that but that did not work to.
To successfully publish and run your website on your host machine, the host machine must first have IIS (Microsoft's Internet Information Server) installed and running.
Once you have that in place there are several different approaches to deploy your website to the host. Here is a link to guidance from Microsoft's asp.net site in regards to "Choosing the Right Approach to Web Deployment".
Specifically, for you to be able to go "right click -> Publish" from within Visual Studio the relevant approach is "Web Deploy Handler (Publishing)" and you can find detailed instructions for setting it up in "Configuring a Web Server for Web Deploy Publishing (Web Deploy Handler)".
You just upload the files.
But you msut be sure that IIS is configured th acctually watch for a .NET app in the folder it loads in.
For normal we apps you did the right:
Also tried uploading all the files from the project folder but it did not work.
If it "just does not work" then it means .NET is just not there on that server or the folder you upload to is not configured to load a .NET project. Period. This is a fallback (technically you can upload less - the project file, i.e., is not needed), but it should work.

Categories