How to map a domain name like www.something.com to Hosted ASP.NET Core 6 api as Windows Service using Kestrel server - asp.net-web-api

In my current project. The previous dev has hosted an asp.net core 6 Web API as a window service using Kestrel on azure window virtual machine. I have to create a replica on the same API; please take a reference to the below links.
https://learn.microsoft.com/en-us/aspnet/core/host-and-deploy/windows-service?view=aspnetcore-6.0&tabs=visual-studio
https://dev.to/sumitkharche/how-to-host-asp-net-core-3-1-web-applications-as-windows-service-52k2
I can create, build and install the API as a window service in an azure virtual machine and local machine as well, which also works in localhost: port.
Now I want to map that API to some domains like www.someting.com. But cannot find a way how to map a domain.
In this window service way, API hosting is pretty new to me, and there is also not enough documentation that can help me.
Please suggest.

Related

Service Fabric hosted Web API

I've created a simple Stateful Actor and a Web API (self hosted) and deployed it to Azure. It has worked and I can browse the nodes in the Service Fabric Explorer.
Azure gives me a url but when I add /api/values to the end (which works fine locally) it downloads a file called values and I can't open it as it is a binary file.
I want to call the web api from a Xamarin app (ie normal Rest api call) but if I can't call it via a browser I'm a bit stuck.
I would comment this on Stephen's answer, but I lack sufficient reputation.
To add a custom port to the Load Balancer after the service fabric cluster has been created you can (in the newer Azure portal):
Navigate to the load balancer resource for your service fabric cluster.
Under "Settings" find the "Load balancing rules" option.
This will have at least two rules, more if you did setup custom rules during the setup of the cluster.
Add a new rule.
Give it a name
'Port' is the external port you'd like to hit.
'BackendPort' is the port your service is configured to listen on.
The defaults on the other settings work in a pinch.
Note if you have multiple ports to enable, they each need their own rule.
I do know the above worked in my 'hello world' sandbox project.
I'm climbing the service fabric learning curve myself so I can't comment with authority on the other settings.
Have discovered what was missing.
https://azure.microsoft.com/en-us/documentation/articles/service-fabric-cluster-creation-via-portal/
This link here walks through creating the Service Fabric app on Azure and in particular the field "Application input endpoints" needs to have the port you want to use. For the samples, they are mostly port 80 or 8081.
There is supposed to be a way to add these ports afterwards which I tried (and so did a Microsoft support engineer) and it did not seem to work. You are supposed to be able to add these ports to the Load Balancer associated with the Service Fabric App.
I recreated my Service Fabric app, exactly as I did before but this time filled in the ports I want to use in the Node Type section and now I can hit the webapi services I've deployed. This field can be left blank which is what I did first time round and was why I had issues.
Not really related to Service Fabric, it's just how you set up your HTTP response headers in Web API. Recommend tagging this with asp.net or asp.net-web-api for a more thorough answer.
Tutorials and technical resources around Azure Service Fabric Stateless Web API tend to be slightly disjointed, given that the platform and resources are still quite immature.
This Stateless Web API tutorial, at the time of writing, is very effective.
As prerequisite to the tutorial:
Update Visual Studio to the latest version (Extensions and Updates)
Update the Service Fabric SDK to the latest version (Web Platform Installer)
Explicitly specify the EndPoint Port attribute (defined in ServiceManifest.xml) when setting up your Azure Service Fabric Cluster Node Type parameters
Following these steps will successfully allow deployment to both local and remote clusters, and will expose your Web API endpoints for consumption.

Azure: Will I be able to use source control integration?

Currently, my visual studio solution has 3 projects:
MVC project - to be deployed at say www.something.com
Web Api - to be deployed at api.something.com
SPA application - to be deployed at app.something.com
Will I be able to host all of these just through VSO source control? I am not sure if azure would be able to host the applications at respective sub-domains without explicitly defining them?
Can anybody please clarify? And what would be the best approach?
if you host your application on Azure App service, there is continues deployment service. You can have your code next to your site (Local Git https://azure.microsoft.com/en-us/documentation/articles/web-sites-publish-source-control/) or you can have your code in supported repository e.g github/bitbucket etc ..
And Azure App Service supports virtual directly, you can have multiple apps in the same site. see detail answer from here Publish Multiple Projects to Different Locations on Azure Website

New to ServiceNow, how do I attach a server via web services? (DemoNow)

This might sound completely stupid but I'm new to this.
Anyway, here's my question:
I have a virtual WordPress server (bitnami) running on VirtualBox. Currently it's in my local network with an IP of 192.168.43.11. With a Gravity Forms plugin for WordPress I made a survey website.
How do I attach my survey website to ServiceNow? I think I'm supposed to utilize Service Now Web Services, but I'm lost after that..
Do you know what version your ServiceNow instance is? If it's Eureka or later, you can use the REST API: https://wiki.servicenow.com/index.php?title=Getting_Started_with_REST. All tables are accessible for CRUD operations via the Table API.
If it's prior to Eureka (Dublin, Calgary, etc.) you can use SOAP: https://wiki.servicenow.com/index.php?title=Direct_Web_Services.

Windows azure project architecture

I am new to windows azure plateform i want to ask a very basic question. I am doing a project on windows azure and due to some concurrency problems i want also my Browser GUI to be in the cloud which will call the web services which are also deployed in the cloud.
Just need to ask that is it possible that i will also put my GUI in the cloud and i have some URL which i will hit so that my GUI will appear in the users browser...
I want my architecture some what like that
Sorry for the drawing but i am in very hurry
Your web browser would be on the user's desktop, and make a HTTP request to a web application/site that is hosted in Windows Azure. For instance, an ASP.NET MVC web site that makes a service call to a WCF service, that then retrieves data from a SQL Azure database. One way to do this would be to create a single hosted service that contains:
Web Role (to host your ASP.NET site)
WCF Web Role (to host your WCF service)
SQL Azure (for your database)
I think the web GUI you mentioned would be like an agent, it will connect to the real websit and render the content for you. If this is true I would like to say in theroy it's possible, but in practice it will be very difficult, since what you want to do is a web based web browser. You might need to handle HTML, CSS and JS, etc.. But if it's just a web ui that render your data from your service that is fine. So back to your question, when you said the "browser gui", if it's a desktop application, you cannot run it on the cloud; if it's a website then yes you can and your proposal looks fine.
Hope my feedback helps.

Debugging a Windows CE application which uses a Microsoft Azure service

This question has probably less to do with actual programming and more to do with environment setup.
I'm developing an application for a Windows CE device, which will use a service hosted in Microsoft Azure. Obviously, this is all under development, and the service itself has not yet been uploaded to Azure. So I'm using the emulators provided by MS to deploy the service locally. Also, I don't think uploading the service to Azure just to debug it is a good idea, as that could net us a bill for Azure we don't yet want to pay.
Also, please note, I'm using VS2008 for the Windows CE project and VS2010 for the Azure project (thank you MS for dropping support for mobile devices -_-).
The problem is, the service seems to be accessible only via 127.0.0.1 or localhost, and if I physically connect a Windows CE device or use an emulated one, it becomes a new entity on the network, and cannot access that service any more.
How can I debug my Window CE application and have it see the service, whilst still being able to debug the service itself?
You are correct, the development fabric (the compute emulator that allows you to build an azure application and debug it locally) is only meant for local development. There are some hacks that allow you to get around that, but I wouldn't recommend it.
My recommendation would be to spin up the service in a more traditional hosting environment, at least in these early stages. You can define it as a web app just as you always would have, and get it functioning. Then, when you know its mostly complete, create a cloud service project and do an add existing to bring your web app into the cloud service solution. Once in, its a simple matter to add the web app as a web role.
From there, you can complete testing of the service in both the local and hosted azure environments as needed. This allows you to minimize your development costs while still leveraging the power of the cloud. As an upside, you also have done most of the basic work to ensure your service is compatible with multiple deployment scenarios giving you a greater degree of choice for its final production state.
OK, I don't know if this was intentional, or if I found one of the mentioned hacks, but I saw that IIS hosts the Azure site I created on port 5100, and the binding for this site is *, so it accepts all connections.
Using this I could access the service from my emulator, and I could still debug all Azure related stuff.

Resources