How do I host a public static site as a web app? - azure-web-app-service

I want the url www.example.com to display default.html
From this question I understand that the easiest way is still to create a web app.
[How not to do it]
I tried creating a solution in VS2017
File->New ->Project -> .Net Core -> Asp.Net Core Web Application-> Empty
Then I moved my static files into wwwroot and deployed
What do I need to change so that default.html will load when someone goes to the site?
At the moment if I remove the Program class I get a message
Severity Code Description Project File Line Suppression State
Error CS5001 Program does not contain a static 'Main' method suitable for an entry point
which is understandable since it is a web application , how do I change it to be a static web site?
[A better way, create the app in Azure.]
Instead of the above method I created a new web app and followed the advise at this question to paste in index.html.
I can now go to the Azure url for the site and the correct content displays.
Next I need to get example.com to work.
I added the CName record for www in my DNS with the url for the site, and I also went to Custom Domains in Azure to add my domain name.
However I get the following error when I go to my site.
Error 404 - Web app not found.
The web app you have attempted to reach is not available in this Microsoft Azure App Service region. This could be due to one of several reasons:
1. The web app owner has registered a custom domain to point to the Microsoft Azure App Service, but has not yet configured Azure to recognize it. Click here to read more.
When an app owner wants to use a custom domain with a Microsoft Azure Web Apps web app, Azure needs to be configured to recognize the custom domain name, so that it can route the request to the appropriate server in the region. After registering the domain with a domain provider and configuring a DNS CNAME record to point to the app's Azurewebsites.net address (for example, contoso.azurewebsites.net), the web app owner also needs to go to the Azure Portal and configure the app for the new domain. Click here to learn more about configuring the custom domains for a web app.

I got it working in the end. I must have missed a step in the documentation

Related

Change the URL of a Azure Static Web App from the randomly generated name

I created a Azure Static Web App in Azure. The process saved a workflow file in the Github repository and created a URL https://nice-beach-0253b8b10.azurestaticapps.net. How can I change this URL?
You currently can't change the azurestaticapps.net itself. However, you can configure a custom domain (using your own domain provider) or setup a CNAME record.
See more info: https://learn.microsoft.com/en-us/azure/static-web-apps/custom-domain?tabs=azure-dns
Unfortunately, you cannot pick and choose your app URLs. But if you hate only the nice-beach part, you can always create another Static Web App resource and hope for the best as Azure picks a random two-word phrase every time.
Static web apps are just another Azure app service and you should be able to set up custom domains as you normally do for any other app service.

How do I map a URL to a uksouth.cloudapp.azure.com website

I have a website running on Azure: -
e.g. mysite.uksouth.cloudapp.azure.com
I have purchased a domain e.g. www.mysite.co.uk
When I go to https://www.mysite.co.uk I want to display the website mysite.uksouth.cloudapp.azure.com.
I've tried adding an app service in azure, but it gives me the URL https://mysite.azurewebsites.net.
So https://www.mysite.co.uk now brings up a Azure welcome screen asking me to deploy my code.
How do I get https://mysite.co.uk to display https://mysite.uksouth.cloudapp.azure.com?
Thanks.
Ian.
I found this https://learn.microsoft.com/en-us/azure/cloud-services/cloud-services-custom-domain-name-portal#add-a-cname-record-for-your-custom-domain
So I deleted my App Service in Azure, as that's not what I needed and followed the above instructions to configure the DNS for cloudapp.
You have to map your custom domain name to the web app. Below is the Microsoft doc with the steps.
Custom Domain

Azure domain configuration

I have an APP that was awarded the gorunning.pt domain. It happens that when I call the gorunning.pt domain without the www everything works, when I add the www http://www.gorunning.pt/ I receive the page 404 application not found.
I've already set the DNS CNAME for the application of IP , also tried the url gorunning.azurewebsites.net defined by Azure , created a type A registration.
This is expected. Your DNS configuration is correct. However the Azure Web App's front-end doesn't recognize the www sub-domain as it is not mapped in the portal.
You will also have to map the www.gorunning.pt to your web app gorunning.azurewebsites.net in the Azure Portal. :)
From the dig web interface, it seems the domain has mapped to the Azure web app. However it shows 404 not found. As I know your custom domain maps to an empty web site, so the easiest way is deleting your existed web site then custom domain to the new web site again. If you still encounter the same issue, please submit a ticket via the following screenshot.

Azure Custom Domain (Namecheap) not working without www

I thought I had all my mappings perfectly done:
I'm able to add the www.mydomain.me to azure but not mydomain.me. Is there something I'm missing?
Edit: When I attempt to point to mydomain.me in my broswer, I get the following error message:
Error 404 - Web app not found.
The web app you have attempted to reach is not available in this Microsoft Azure App Service region. This could be due to one of several reasons:
1. The web app owner has registered a custom domain to point to the Microsoft Azure App Service, but has not yet configured Azure to recognize it. Click here to read more.
2. The web app owner has moved the web app to a different region, but the DNS cache is still directing to the old IP Address that was used in the previous region. Click here to read more.
Thanks
It's hard to tell what's wrong since you've hidden the settings. Here's what should work:
A Record points to the IP address found on the Azure portal
CName awverify points to awverify.yourservice.azurewebsites.net
CName www points to yourservice.azurewebsites.net

Microsoft Azure - Getting a 404 page using custom domain with my web app

There's an issue with an Azure website I'm working on where I get an azure 404 page when trying to access my web app (set up with a custom domain) without www. (with www. the site works fine). NS lookup shows that when using the naked domain (infratecheng.com) the results are different than when looking up the full domain (www.infratecheng.com).
(source: cassey.org)
The custom domain has been set up as per the instructions on the azure portal.
I wonder if this is a problem with configuration within azure or is it a problem with my domain provider settings?
Many thanks
Most likely, the problem is that you only added www.infratecheng.com as a host name for your Azure Web App, but did not add infratecheng.com. So when Azure gets requests to infratecheng.com, it doesn't know about any site that can handle them, and returns a 404.

Resources