web.config to run dist folder deployed on azure app service via FTP - ftp

I am using Vue CLI project and wants to deploy the dist folder to Azure App Service via FTP but I am missing with web.config file to run my deployed app service.
I am trying to do this answer but can't find a web.config file for my reference.
Thanks in advance for your answers.

FTP deployment doesn't support build automation like:
generation of web.config
dependency restores (such as NuGet, NPM, PIP, and Composer automations)
compilation of .NET binaries
Generate these necessary files manually on your local machine, and then deploy them together with your app.
Add web.config file with a URL Rewrite rule
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="Handle History Mode and custom 404/500" stopProcessing="true">
<match url="(.*)" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Rewrite" url="/" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
Vue CLI generated projects are configured to copy anything in the public folder directly into the build output directory (dist by default).
Put it in /public It will then be copied over to /dist during build.
I have created the config file in public folder, After running npm run build , web.config file is copied to dist folder.
To create web.config,Right click on the public folder-->Add new file, name it as web. Config and add the above mentioned code snippet and save.
Go to Azure portal, your Web App =>Advanced Tools=>KUDU - Debug Console =>CMD =>
site=>wwwroot ,
check if web.config file exists or not.

Related

We app is terminated automatically at Windows server

I've my go app the is running a web API and working smoothly at my laptop.
I read this and completed the IIS setup using a config file:
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="ReverseProxyInboundRule1" stopProcessing="true">
<match url="(.*)" />
<action type="Rewrite" url="http://localhost:9000/{R:1}" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
And copied the compiled file at the same location, but once I gone for the url I got nothing, and once I run the .exe file I got it terminated quickly!
Any idea how to be able to run this execuatble file at MS server.
UPDATE
If I removed the binding at the server, then the app is working fine, it looks this binding process is blocking the port!

how to host nestjs application in windows iis server

i want to host nestjs application in windows iis server. i generated dist file using npm build. these are the files generated
files after generating dist
added my application in iis
web.config
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<handlers>
<add name="iisnode" path="main.js" verb="*" modules="iisnode" />
</handlers>
<rewrite>
<rules>
<rule name="nodejs">
<match url="(.*)" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
</conditions>
<action type="Rewrite" url="/main.js" />
</rule>
</rules>
</rewrite>
<security>
<requestFiltering>
<hiddenSegments>
<add segment="node_modules" />
<add segment="iisnode" />
</hiddenSegments>
</requestFiltering>
</security>
</system.webServer>
</configuration>
someone please help with the hosting
To host yout NestJs application you will need to use IIS like a proxy to your dist code.
Run the aplication with npm install and npm start (or the script to start yout back end).
After that you will have your backend running locally with an assigned port. So configure your IIS to work like a reverse proxxy for you application, like on this post: https://tecadmin.net/set-up-reverse-proxy-using-iis/

Can't commit several files from Visual Studio project to subversion

Since a few weeks, I have some problems with Subversion. When I try to commit files from a Visual Studio 2017 project there are some files which I can't commit to my Visual SVN Server. To be precise all files in the project folder like *.cs, *.config, *.csproj, *.resx, ...
My setup:
Client: TortoiseSVN 1.9.7 on Windows10
Server: VisualSVN behind a IIS-ReverseProxy running on Windows Server 2012r2
The error I get when I try to commit for example a *.cs file:
Commit
D:\Test\branches\ScaraControl\ScaraControl\Form1.cs
D:\Test\branches\ScaraControl\ScaraControl\Form1.cs
Commit failed (details follow):
File 'D:\Test\branches\ScaraControl\ScaraControl\Form1.cs' is out of date
'/svn/Test/!svn/txr/5-9/branches/ScaraControl/ScaraControl/Form1.cs' path not found
You have to update your working copy first.
Updating the working copy is finishing successfully but doesn't fix the problem.
You can see my project in the picture below. For testing, I created a completely new and empty repository. As you can see the .vs, bin and obj folders are ignored with all the files inside of them, all other folders are committed to the server (without the files inside of them). In the second picture you can see that I can commit the *.sln file but no other file in the project folder.
For testing, I created an empty text file and renamed it to text.cs. Even this empty file cannot be committed to the Server with the same error message.
Due to the fact that this is happening to all Clients, it is more likely to be a problem on the Server side I guess but I have no idea what could cause this error. Unfortunately, the VisualSVN Server has no error logging or at least not the free version I'm using.
I would be very grateful for any tip I can get to solve this annoying problem.
Edit1: Problem is caused by the IIS Reverse-Proxy
After connecting via port 8443 directly to the VisualSVN server (bypassing the reverse proxy) everything is working again. So there must be a problem with the configuration of the URL Rewrite module. To be honest it took me quiet a long time to get it working somehow because my knowledge about all the settings is very limited.
This my Web.config with the settings for the URL Rewrite module. Maybe there is something not configured as it should be. If you need further information just ask.
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<outboundRules>
<rule name="ReverseProxyOutboundRule1" preCondition="ResponseIsHtml1" enabled="true">
<match filterByTags="A, Form, Img" pattern="^http(s)?://svn.example.org:8443/(.*)" />
<action type="Rewrite" value="http{R:1}://svn.example.org/{R:2}" />
</rule>
<preConditions>
<preCondition name="ResponseIsHtml1">
<add input="{RESPONSE_CONTENT_TYPE}" pattern="^text/html" />
</preCondition>
</preConditions>
</outboundRules>
<rules>
<rule name="ReverseProxyInboundRule1" enabled="true" stopProcessing="true">
<match url="(.*)" />
<conditions>
<add input="{CACHE_URL}" pattern="^(https?)://" />
</conditions>
<action type="Rewrite" url="{C:1}://svn.example.org:8443/{R:1}" />
</rule>
</rules>
</rewrite>
<security>
<authorization>
<remove users="*" roles="" verbs="" />
<add accessType="Allow" users="" roles="Users" />
<add accessType="Allow" users="*" />
<add accessType="Allow" users="?" />
</authorization>
</security>
<urlCompression doStaticCompression="false" doDynamicCompression="false" />
<httpRedirect enabled="false" destination="https://svn.example.org" exactDestination="true" childOnly="true" />
<directoryBrowse enabled="false" />
</system.webServer>
</configuration>
I had the same issue.
The fails because IIS prohibits URL suffixes like .cs and .config
You can work around this by adding this to the web.config of the IIS proxy
<system.webServer>
<security>
<requestFiltering>
<fileExtensions allowUnlisted="true" applyToWebDAV="true">
<clear />
</fileExtensions>
<verbs allowUnlisted="true" applyToWebDAV="true" />
<hiddenSegments applyToWebDAV="true">
<clear />
</hiddenSegments>
</requestFiltering>
</security>
</system.webServer>
Credits to this post IIS7 and ARR as reverse proxy for Subversion
I came across the same problem and am running a reverse proxy through IIS, so believe that has something to do with it.
VisualSVN is served up locally on https://localhost:8443 and I was attempting to use the reverse proxy to route from https://svn.mysite.com. This appears to work fine. You can even checkout a fresh copy of the repo and all files are downloaded. It's when you try and commit that you have problems - as you've identified, certain files fail to be found on the repo.
The only work around I have found (thanks to your question narrowing down the likely causes) was to add the port to the URL: https://svn.mysite.com:8443. This shouldn't be necessary as the reverse proxy should handle, so I'm guessing it's an issue with VisualSVN which may be fixed in a future update.

IIS 7.5 URL Rewrite rule higher priority than folder

I have this rule in web.config.
<rule name="RewriteSourceCategorySuburb" stopProcessing="true">
<match url="(news)$" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false">
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Rewrite" url="default.aspx?category={R:1}" />
</rule>
The problem is I have the folder name called "news" in my root and it doesn't even have default.aspx in that folder but the web server is trying to view the folder "news" and shows this error "403 - Forbidden: Access is denied. You do not have permission to view this directory or page using the credentials that you supplied." when I request mysite.com/news. Is it possible to make my rule to be processed higher than that folder name? Thanks.
Note: It is not just news folder it is happening all name with the same folders, I need to change a lot to rename those folders to something else. Please help. :(
I ran into a similar issue last month, and it ended up being an authentication setting within IIS. One thing you could check is the authentication settings in IIS, and change Anonymous Authentication to use the Application Pool Identity instead of the default, "IUSR".
You also need to have the URL rewrite module installed where your IIS is installed, here is a link http://www.iis.net/downloads/microsoft/url-rewrite

publish nodejs express on iis 7

I'm using:
node 0.6.19
npm 1.1.24
on Win7 pro and iis 7.
I have a folder named 'test' in iisnode/www/. In this folder I want to create a fresh nodejs-express-app.
what I did
create a folder in another Directory like D:/development/node/test
run in console: npm install express -g
run: express -t jade
run: npm install -d
with 'localhost:3000' all is fine.
Now I replace the port '3000' with 'process.env.port' in app.js
Copy all files in iisnode/www/test
get the web.config and set the handlers and rewrite rules
<handlers>
<add name="iisnode" path="app.js" verb="*" modules="iisnode" />
</handlers>
<rewrite>
<rules>
<rule name="express">
<match url="test/*" />
<action type="Rewrite" url="app.js" />
</rule>
</rules>
</rewrite>
I restartet the iis and get: "Cannot GET /node/test/app"
Where is my mistake?
Can someone help me?
I'm not a master with the IIS.

Resources