I would like to create a simple static web site on Azure Web Apps. I don't want any VS or PowerShell so I have just connected my Azure Web App to my OneDrive account. I just want to edit my local files and see them on site.
I have created new web app, connected it to my OneDrive account and this step was fine, it created apps/Azure Web Apps/""app name"" folder in my OneDrive so I have placed some html/css files there. Web App was synchronized; however, I could not open any html file (404 could not get resource index.html).
I FTP-ed site and I have found that there is a following element in my Web.Config file:
<rule name="StaticContent">
<action url="public{REQUEST_URI}" type="Rewrite"/>
</rule>
Ok, so by default it assumes that static content will be in "public" folder so I have created "public" folder in my OneDrive and moved html file there. I have opened html file on my site url via browser and it was shown successfully!!!
Now, I have copied some other html/css files in subfolders of my "public" folder, but I cannot open them. Http requests to ""site""/somefolder/file.html ""site""/somefolder/file.css returns 404.
It seems that StaticContent rule do not matches subfolders.
I can continue hacking this and modifying iisnode rewrite rules, but am I missing something?
I just want simple static site connected to my OneDrive or Dropbox account, no VS, no power shell, no customization. Is it possible that this is a minefield if you are using the simple use case? Is there some tutorial or setting that I have not found?
It's actually a lot simpler than what you tried.
As CSharpRocks already suggested in a comment, you could place static HTML files and resource files into the root folder. However, you did say that you want to use your OneDrive account.
The trick is to identify the source location on your OneDrive account, after you set it up on Azure. It looks like you already tried that initially, but it appears that you also moved the files to a different "public" location.
Just to clarify, here are the steps that I performed.
In your Web App settings blade, click Continuous Deployment to select OneDrive, authenticate and choose the name, e.g. schtml5.
In your OneDrive account, find the source location, e.g. /Apps/Azure Web Apps/schtml5/
Place your static files into the above OneDrive location.
Since you already have continuous deployment set up (from Step 1), your website should be updated automatically every time that OneDrive folder (from Step 2) is updated. Make sure you choose to replace files when uploading any newer versions of files that already exist.
But you also mentioned that you have a Web.config file. Since you only have static files, you don't need this configuration file. Delete the Web.config file in Azure. You could use FTP to access your "/site/wwwroot" folder to delete the file. Make sure that you don't include the config file in OneDrive.
Hope that helps! :-)
Screenshots of my Azure portal and OneDrive below:
In MS Build 2020 Microsoft announced the support for hosting Static Web Apps which allows you to build JavaScript web applications that automatically publish from changes made in GitHub.
This new option is ideal for static site generators such as Hugo,
Jekyll and Hexo or for developers who use frameworks like
Angular, Vue and React and seek a simple interface to deploy
the cloud resources needed for a single-page application.
Here is an example to get started.
Related
I need help setting a homepage for a web app that is hosted on Azure. I can get to the site using my-site.azurewebsites.net/Websites-UI/index.html. How/where can I change settings in Azure to point to this index.html file without specifying the folder? (i.e., when a user browses to my-site.azurewebsites.net, it redirects to index.html in the Website-UI folder)
I have a github repository that has the Websites-UI folder that contains index.html and css files.
I am new to web development and Azure. Any help is appreciated.
According to your original requirement, you just need to change the value of virtual directory to site\wwwroot\Websites-UI in application settings tab in your Azure portal.
Here's the reference>Direct default URL to a custom directory
When I publish my site to Azure web app I see a blank site with title 'Site Under Construction', how can I change that default page
In Azure Web Apps, the default document is the web page that is displayed at the root URL for a website. The first matching file in the list is used. Refer File structure on azure to know more about the files and directories on Azure Web App.
You can add a default document in the default documents list.
Go to Web App -> Settings -> Application settings -> Default documents -> Add and save
You may also check whether the deployed files are available or not using Kudu Console.
Hope this helps.
You can also edit the standard placeholder file, simply log to your Web App using an FTP client like FileZilla, download and edit the hostingstart.html file located in the site/wwwroot folder.
I try to setup a azure web apps to use Dropbox as the source, BUT
1, I can not choose the folder, it force me to create a new folder, when I click the choose folder menu, it only list one which is the name of this new web apps, doesn't showing the other existing folders in my dropbox. But I have some existing folders under the dropbox, which some of them are using by my other web apps.
2 then I try to change the account, go the authorization menu, when I click the Change Account button, it open a new window with http 400 error, with following information:
https://www.dropbox.com/oauth2/authorize?client_id=kiqukvsyjo7cymc&redirect_uri=https%3A%2F%2Fportal.azure.com%2FTokenAuthorize&response_type=code&state=09f09ec2-13d0-4613-97c2-19abdab1957d
Error (400)
It seems the app you were using submitted a bad request. If you would like to report this error to the app's developer, include the information below.
More details for developers
Invalid redirect_uri: "https://portal.azure.com/TokenAuthorize": It must exactly match one of the redirect URIs you've pre-configured for your app (including the path).
.
This used to work very smoothly but seems not working anymore.
Any idea?
It was an issue on the App Service side, caused by the switch over to the v2 Dropbox API. Both issues are now resolved, so you should be able to change the account as well as pick an existing folder.
I have created a Nopcommerce CMS website via Azure websites gallery. Now I need to migrate the .sln file and databases to my PC to give the whole package for a friend. How to do this.
There are a couple of ways to do this.
You could just connect to your web site using an FTP Client (ie:
FileZilla) and just pull the files down that way, or
Use Site Control Management ("Kudu") to download a .zip of your web site.
I prefer #2. It's fast and easy.
Here are the steps for #2:
1). Navigate to your website using your browser.
2). Replace the URL in the browser to reference the Kudu companion site for your web site. For example, if your site is contoso.azurewebsites.net, change the URL to contoso.scm.azurewebsites.net.
If prompted to authenticate, sign-in using your Azure Subscription credentials.
3). From the Kudu menu, select the Debug Console -> CMD option.
4). Click the download link for the site folder. This will package the site up into a .zip file and start the download.
5). Extract the .zip on your local hard drive and you're on your way.
When I check in my modifications to Visual Studio Online, an automatic deployment of the Azure website is done.
Is there a way to just replace some files in the Azure website, without deploying the whole website?
You can login to the site via FTP. Or you can use ServerExplorer in VisualStudio 2013 and modify files there:
You can also use the Kudu Debug Console to change files in your site. Go to http:// [yoursite].scm.azurewebsites.net/DebugConsole and log in with your FTP credentials
If you have publishing profile for azure loaded in your website then It is possible to select just your aspx pages(for design changes) .Right click aspx page and publish.
In case of code changes,full project must be published as code goes into dll's.