I have created a web site using the standard ASP.Net MVC 5 template with no authentication. I have added MVCSiteMapProvider from NuGet. On my dev machine the /sitemap.xml endpoint returns the correct sitemap once I add the UrlRoutingModule-4.0 to web.config. If I publish to Azure Web Sites the /sitemap.xml endpoint also works. However if I publish to my local hoster the /sitemap.xml endpoint returns a 404 - File or directory not found.
Any idea what I need to change / add to web.config to get the endpoint working?
Thanks
Tim
As far as I am aware, this configuration is all that is required to make it function in MVC4/MVC5:
<system.webServer>
<modules>
<remove name="UrlRoutingModule-4.0" />
<add name="UrlRoutingModule-4.0" type="System.Web.Routing.UrlRoutingModule" />
</modules>
</system.webServer>
But then, I don't have much of an idea why this line is required, a contributor figured it out and I added the solution to the NuGet package.
Related
I am deploying ASP.NET Core Web API for the first time.
I am facing issues and confused on few things.
1) I followed this link Host ASP.NET Core Web API and have no issues until step 5. My Core Web API has Swagger UI and UI not showing up.
2) I followed this link Deploy ASP.NET Core to IIS and in step 3 I am not sure how he gets Add Application. My IIS always show Add website.
I followed this link too Host ASP.NET Core on Windows. I tried from 2 days haven't get working on IIS.
I deployed using Web Deploy and Folder too. None of them worked
This is my Web Config file
After Diagnostics, I am here. Runtime doesnot match. I tried to install from that link and still not working.
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<location path="." inheritInChildApplications="false">
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
</handlers>
<aspNetCore processPath="dotnet" arguments=".\SampleCoreApi.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" />
</system.webServer>
</location>
</configuration>
The first link is talking about hosting the ASP.NET Web API and not ASP.NET Core Web API.
When you are hosting ASP.NET Core app/api, you need to set the .NET CLR version of the application pool to No Managed Code
This is also mentioned in the Step 3 of the second link. It's creating an application under the Default Web Site, that's where you see the Add Application option. It's not necessary to create an application under the Default Web Site.
You can either create the Application Pool first and set it to No Managed Code. Then, when adding a new website, you can select this application pool
Or, add a new website first. That will create an application pool automatically with the same name as the web site. Then, you edit the application pool and set it to No Managed Code
I hope that helps.
I am new to Azure and currently host my node.js backend at another cloud provider, and I want to understand the steps I need to make in order to host it at Azure, without using Visual Studio Code.
It is a very easy question, yet it seems impossible to find an answer to.
I've seen the 5mins quick starts here;
https://learn.microsoft.com/en-us/azure/app-service/app-service-web-get-started-nodejs
But in the guide, the site is directly deployed to the web URL;
https://learn.microsoft.com/en-us/azure/app-service/app-service-web-get-started-nodejs#browse-to-the-app
But none of them explains the fundamentals on how Azure runs the process.
How does Azure start my backend app? Where do I configure that, what is needed?
That's not mentioned in the guide at all.
Is there a guide for what exactly what files are required and how to configure them in order to start my backend?
Microsoft Azure feels like a black box right now, any documentation is much appreciated!
As I know, you need to configure web.config if you want to run nodejs app on the Azure.
I followed this sample node.js app: nodejs-docs-hello-world and deploy it to Azure. It works fine,you could refer to web.config file:
<?xml version="1.0"?>
<configuration>
<system.web>
<compilation batch="false" />
</system.web>
<system.webServer>
<handlers>
<add name="iisnode" path="scripts.js" verb="*" modules="iisnode" />
</handlers>
<rewrite>
<rules>
<rule name="myapp">
<match url="/*" />
<action type="Rewrite" url="scripts.js" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
I suggest you navigating to the KUDU url: https://<your app name>.scm.azurewebsites.net/DebugConsole and go to site\wwwroot to upload your files so that the files are contained within a directory.
Or discard zip deploy temporarily, just drag the local files directly to the d:home\site\wwwroot directory.
I am trying to deploy an Azure App Service from Visual Studio 15.2. Specifically I am trying to deploy this following service: https://github.com/Microsoft/Azure-SQL-DB-auditing-OMS-integration to ingest audit logs from SQL Data Warehouse to OMS. However, due to security concerns, we would like to do so without creating a public endpoint, a url. We have tried configuring it in a VNet but it does not allow you to do so unless the VNet has a public gateway.
Configure Azure App Service without public URL
As far as I know, we couldn't configure Azure App Service without public URL. If you created a web app, it will auto provide public endpoint for user to access.
Here are two work around.
I found the github application just use the web app's webjobs.
One way:
If you don't need any web site, just use the backgourd process to run the webjobs, you could choose azure function which uses WebJobs SDK itself but doesn't require an App Service to be configured for it.
Second way:
Normally we run WebJobs in a Azure App Service web app, and that Azure App Service web app can be accessed/browsed via URL. If you want to prevent users from browsing to that Azure App Service web app, you can add a rewrite rule to site’s web.config to block web access.
The web.config is like this:
<?xml version="1.0" encoding="utf-8"?>
<!--
For more information on how to configure your ASP.NET application, please visit
https://go.microsoft.com/fwlink/?LinkId=169433
-->
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="Block unauthorized traffic to staging sites" stopProcessing="true">
<match url=".*" />
<conditions>
<!-- Enter your staging site host name here as the pattern-->
<add input="{HTTP_HOST}" pattern=".*" />
<!-- Enter your white listed IP addresses -->
<add input="{REMOTE_ADDR}" pattern="123\.123\.123\.1" negate="true"/>
<!-- Add the white listed IP addresses with a new condition as seen below -->
<!-- <add input="{REMOTE_ADDR}" pattern="123\.123\.123\.2" negate="true"/> -->
</conditions>
<action type="CustomResponse" statusCode="403" statusReason="Forbidden"
statusDescription="Site is not accessible" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
More details about how to add the web.config to your web app, you could follow this steps:
1.Open kudu tool in web portal.
2.Open cmd console and locate the \site\wwwroot folder.
3.Create web.config and copy the settings in it.
4.When we accessed the web site, you could find this:
I have two different applications which I want to deploy on the same Azure WebApp like this:
webapp.azurewebsites.net/api/ <-- run the Java REST API here
webapp.azurewebsites.net/site/ <- put the Angular2 app here
Problem
Both apps are deployed on the server but currently I'm only able to get the REST API running with a web.config like this:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="Force HTTPS" enabled="true">
<match url="(.*)" ignoreCase="false"/>
<conditions>
<add input="{HTTPS}" pattern="off"/>
</conditions>
<action type="Redirect" url="https://{HTTP_HOST}/{R:1}" appendQueryString="true" redirectType="Permanent"/>
</rule>
</rules>
</rewrite>
<handlers>
<add name="httpPlatformHandler" path="*" verb="*" modules="httpPlatformHandler" resourceType="Unspecified"/>
</handlers>
<httpPlatform processPath="%JAVA_HOME%\bin\java.exe"
arguments="-jar D:\home\site\wwwroot\webapps\rest-api.war">
</httpPlatform>
</system.webServer>
</configuration>
but I'm not able to reach the Angular2 app on the server and I can't find documentation how I would configure the Java application and the Angular2 app at the same time.
I also tried to achieve this with the Virtual applications and directories settings from the Azure dashboard under Application settings - but it didn't work and I can't find a decent documentation of how I would achieve this, or if this is even possible with setting the Virtual applications and directories.
I tried to move the Angular2 site around but was not able to configure the server so that the Angular2 app is accessible while the Java application is running.
Question
Can someone point me to a good documentation on how to achieve this, or describe the deployment process in detail (with regard to the configs, e.g. the Application settings from the Azure Dashboard and the web.config file)?
Per my experience, I think the best way for deploying multiple Apps on Azure WebApps is to set the Virtual applications and directories of Application Settings for your Azure Webapp, please see the figure below.
As reference, please refer to the answer of the SO thread Add virtual directory to existing website on Azure.
Virtual Directories are supported for Azure Websites. See Configuring Azure Websites for what you can do through the Azure Management Portal. From the Azure Portal, click on the Website and go to Configure, then scroll down to virtual applications and directories (the last config section). Just enter your virtual directory and the physical path relative to the site root and click Save.
Regarding the second part of your answer, when investigating the subject I found this blog post to be the best explanation of how the Application Settings from the dashboard interact with the Web.config file:
https://azure.microsoft.com/en-us/blog/windows-azure-web-sites-how-application-strings-and-connection-strings-work/
In particular -
If the application setting(s) happen to already exist in your web.config file, Windows Azure Web Sites will automatically override them at runtime using the values associated with your website.
So the Application Settings tab in the Azure portal will take precedence over your web.config values.
I am facing a weird issue, I have a webapi in my web application "https://myapplicationurl/api/Login/" which worked fine before with local iis deployed website. And after deploying the website to cloud application recently, somehow I am unable to access the webapi "https://myapplicationurl/api/Login/" locally through IIS website.
Any idea with issue?
Solved the issue with following handler in web config Web config:
<add name="ExtensionlessUrl-Integrated-4.0" path="*." verb="*" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />