I have a standard spring boot application hosted on a Bitbucket repo which uses a bitbucket-pipeline.yml file to run a maven build
image: maven:3.3.3
pipelines:
default:
- step:
script: # Modify the commands below to build your repository.
- mvn clean install
From the Upload a custom Java web app to Azure - https://learn.microsoft.com/en-us/azure/app-service-web/web-sites-java-custom-upload Azure documentation it states that this file is needed for my spring boot app
Springboot
In order to get a Springboot application running you need to upload your JAR or WAR file and add the following web.config file. The web.config file goes into the wwwroot folder. In the web.config adjust the arguments to point to your JAR file, in the following example the JAR file is located in the wwwroot folder as well.
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<handlers>
<add name="httpPlatformHandler" path="*" verb="*" modules="httpPlatformHandler" resourceType="Unspecified" />
</handlers>
<httpPlatform processPath="%JAVA_HOME%\bin\java.exe"
arguments="-Djava.net.preferIPv4Stack=true -Dserver.port=%HTTP_PLATFORM_PORT% -jar "%HOME%\site\wwwroot\my-web-project.jar"">
</httpPlatform>
</system.webServer>
</configuration>
I've two questions. Where should I add this file to the existing project directory struture? And then what commands should be added to the pipeline file to do a FTP deploy?
Related
I have a dotnet core 3.1 app deployed to Azure App Service and I want to set the web.config's stdoutLogEnabled value to true once the deployment is complete. I've decided to do this using the Deploy Azure App Service step's inline Post Deployment Action.
The problem is that I don't know how to reference the web.config file in the correct location. What is the environment path to use to target the web.config file in the released folder?
There is no web.config in ASP.Net app , web.config is generated automatically after publishing the project. If you want you can add
Right click on Application folder -->Add new Item --> web.config.
To check your web.config file after Publishing the application.
Go to Azure portal , Open your Web App -->Development Tools -- >Console
Run ls command to check the existing files.
Run cat.web.config command, web.config file code will be displayed.
To Edit the web.config, download WinSCP_Setup.exe file from google and Install.
Enter the Hostname , username and password from the azure portal.
Go to Deployment Center -- > FTP Credentials
Copy the Required Hostname (FTPS endpoint), username and Password and paste in WinSCP Setup.
In right side pane of WinSCP you will find the files of your deployed application.
You can open it and edit accordingly.
You can add a web.config file at the base folder of your dotnet core app or api and then on publishing the application it will be updated in Azure App service or any IIS server where you publish.
<?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=".\MyApp.dll"
stdoutLogEnabled="false"
stdoutLogFile=".\logs\stdout"
hostingModel="inprocess" />
</system.webServer>
</location>
</configuration>
If a web.config file isn't present in the project, the file is created with the correct processPath and arguments to configure the ASP.NET Core Module and moved to published output.
Reference - MS Docs
I'm trying to deploy a netcore2.0 MVC app to IIS and keep getting the error above.
The file permissions are set correctly and I checked that the runtime is downloaded.
The error is as follows:
Module
IIS Web Core
Notification
Unknown
Handler
Not yet determined
Error Code
0x8007000d
Config Error
Config File
\\?\E:\Dev\test-deploy\web.config
Requested URL
http://localhost:4231/
Physical Path
Logon Method
Not yet determined
Logon User
Not yet determined
Following is my Config File (generated by vs code):
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" />
</handlers>
<aspNetCore processPath=".\Coneckt.Web.exe" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" />
</system.webServer>
</configuration>
<!--ProjectGuid: 2833ed36-9a18-47b6-8f33-8998356796d9-->
This error occurs because the ApplicationHost.config or Web.config file contains a malformed XML element, you need to delete the malformed XML element from the ApplicationHost.config or Web.config file.
You can also refer to this link about how to deploy ASP.NET Core on IIS: Host ASP.NET Core on Windows with IIS.
I have created a webAPI using .Net Core and trying to publish it to IIS. But getting HTTP 500.19.
It's looking for web.config file but I don't have it.
What should I do?
Did you installed this: https://learn.microsoft.com/en-us/aspnet/core/host-and-deploy/iis/?tabs=aspnetcore2x&view=aspnetcore-3.1
If Yes check your permissions on the folder. The identity under which your web application runs in IIS may has not full access to the folder in which the web.config file is found. You could change your identity under the appPool or grant access to your folder. If you deployed into the wwwroot folder the IUser should have access to the folder.
When you publish your .net core in IIS please remember to install .net core web hosting bundle because it is not supported by default. IIS handle request based on different handlers. Even when you install the extension, aspnet core module is not registered. So please remember to set
<configuration>
<location path="." inheritInChildApplications="false">
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" requireAccess="Script" />
</handlers>
<aspNetCore processPath=".\myapp.exe" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" hostingModel="InProcess" />
</system.webServer>
</location>
</configuration>
If the solution doesn't fix this. Then something in your web.config is corrupting the application. Please post a screenshot the detailed error message. Then we would know how to fix this completely.
We are using 2 frameworks for developing backend:
NodeJS
Spring-Boot
Can we deploy both builds on the same Azure AppService instance?
Any suggestions?
Yes. It's similar with the other SO threads Installing wordpress on Azurewebsites running Django and How to Deploy Multiple Apps on Azure WebApps.
You can deploy an application in the path wwwroot and deploy the other as a virtual application in the other sub-path of D:\home which you configured the virtual directory and path at the tab Application settings of your website on Azure portal.
Here is the steps as reference.
Create a directory like other in the path site\wwwroot via Kudu console.
Upload the files of your two applications separately into the path wwwroot and ohter.
Create the web.config files separately in their own directory for the different applications, and their content as below.
Sample configuration web.config for starting up a SpringBoot jar, which comes from Deploying Springboot to Azure App Service
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<handlers>
<add name="httpPlatformHandler" path="*" verb="*" modules="httpPlatformHandler" resourceType="Unspecified" />
</handlers>
<httpPlatform processPath="%JAVA_HOME%\bin\java.exe"
arguments="-Djava.net.preferIPv4Stack=true -Dserver.port=%HTTP_PLATFORM_PORT% -jar "%HOME%\site\wwwroot\ROOT.jar"">
</httpPlatform>
</system.webServer>
</configuration>
Sample configuration web.config for a Node.js application, please refer to the wiki page Using a custom web.config for Node apps.
Note to use the different absolute path for configuration to avoid the name conflict.
When publishing a asp.net core app using VSTS (VS2017 build task) the app won't start, build and release works without error.
Symptoms:
App doesn't start when you access the public url through the browser. No logs
when enabling even with verbose logging.
When using Publish from Visual Studio it works perfectly.
When downloading the wwwroot folder using Kudu-tools the web.exe
starts without a problem and runs just fine.
Solution: It turns out that publishing with Visual Studio 2017 adds a Web.Config file with handler mappings to the deployment with the following content which adds the default handler mapping for aspNetCore.
The strangest with this is that the Web.Config file isn't visible in Debug console, just if you download the wwwroot folder from Kudu tools. Something is strange here in the tooling even if it clear that the handler mapping is needed.
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" />
</handlers>
<aspNetCore processPath=".\Web.exe" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" />
</system.webServer>
</configuration>
<!--ProjectGuid: 50547f5d-25a5-4720-9216-92d42583b679-->