Trouble using Silex framework on IIS - symfony

I am trying to configure the silex framework and just get an example application working. I am using an IIS server version 7.5 to do so. On the following website it gives me a sample web.config file I should be using. The file is as follows:
<?xml version="1.0"?>
<configuration>
<system.webServer>
<defaultDocument>
<files>
<clear />
<add value="index.php" />
</files>
</defaultDocument>
<rewrite>
<rules>
<rule name="Silex Front Controller" stopProcessing="true">
<match url="^(.*)$" ignoreCase="false" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
</conditions>
<action type="Rewrite" url="index.php" appendQueryString="true" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
The problem is when trying to navigate to the website I just get the error:
The requested page cannot be accessed because the related
configuration data for the page is invalid.
So essentially IIS says the file is incorrect but I don't have much experience with these files so I don't know if there is a problem. Maybe the file is outdated and the newer doesn't work with newer versions of IIS. There is nothing in the server logs. Anyone come across this problem before?

Turns out I just needed to install the rewrite module for IIS at the following link:
http://www.iis.net/learn/extensions/url-rewrite-module/using-the-url-rewrite-module

Related

Vue.js not scaling after deployment to windows server 2019 IIS

After npm run serve everything's working fine. After i deployed my app with API in ASP.NET application doesnt scale at all. I use Router and History. Authentication for annonymous users is enabled and static content is installed. Console doesn't show any errors.enter image description here
Links to screenshots:
Local run
IIS
What do you mean that vue.js not scaling? The second component display abnormally, is it right?
It might be something wrong with Javascript code snippets working.
Did you install the URL Rewrite extension in IIS and add the below rules in the webconfig file?
<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="index.html" />
</rule>
</rules>
</rewrite>
Here is URL Rewrite extension.
https://www.iis.net/downloads/microsoft/url-rewrite

IIS Symfony 4, 404 Error

I am trying to make works symfony 4 demo application on my environemnt.
I am using IIS with CGI and rewrite module. I can't have access to the home page of the demo, I think my IIS configuration is not well configured. Is there a standard web.config for symfony 4 and IIS? I didn't find anything.
I finally make it works. I convert the rewrite rules of the htaccess to IIS xml.
It looks like below. Hoping it will help others.
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="Imported Rule 1" stopProcessing="true">
<match url="^(.*)$" ignoreCase="false" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
</conditions>
<action type="Rewrite" url="index.php" appendQueryString="true" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>

Hosting Symfony 3 inside subdirectory on IIS

I have a really harsh time trying to get Symfony 3 app work on IIS as website subdirectory.
Structure on IIS :
Application is called pfc and its poiting to directory pfc/web, (IIS is hiding root, because folder name is same as app)
This is web.config:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<defaultDocument>
<files>
<add value="app_dev.php" />
</files>
</defaultDocument>
<rewrite>
<rules>
<clear />
<rule name="StaticFiles" stopProcessing="true">
<match url="^(.*)$" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false">
<add input="{REQUEST_FILENAME}" matchType="IsFile"/>
</conditions>
<action type="Rewrite" url="{R:0}" logRewrittenUrl="true" />
</rule>
<rule name="Symfony 3" enabled="true" stopProcessing="true">
<match url=".?" ignoreCase="false" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false" />
<action type="Rewrite" url="./app_dev.php" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
Entering dev.erp.loc/Test2/pfc ends up with:
like Symfony thinks of itself as a root application, which is not.
My best shoot was to use router.request_context.base_url, but it looks like it worked only in S2.
Now im stuck on something i can call half-way solution
By comment rewrite section in web.config i was correctly redirected to Identity Server, but after log in i get :
In order to fix it, i needed to uncomment rewrite section, to make routing work again, but it works only for browser, leaving it in this state will cause "no route found" in anther browser.
It would be nice to fix subdirectory routing in parameters.yml, which I fill anyway in deploy script, but if there is no other way I can edit web.config too.
Recently I needed to take care of similar issue and as side effect I solved this "problem". My URL without trailing slash is correct. The issue was that Chrome couldn't create canonical url form and made request to endpoint that Symfony don't need to interpret

Angular 2 Visual Studio Setup Problems

I followed the Angular2 VS setup from this page-
https://angular.io/docs/ts/latest/cookbook/visual-studio-2015.html
The issue is that http://localhost:56428/ gives a 403 (forbidden) error, and the only way to access my index is to navigate to http://localhost:56428/src/index.html.
This is not ideal, and doesn't even work because requests to system.js and other files on this page go straight to the web root.
I'm not sure if I missed a step here but I don't think this is what they intended. How do I make src/ servable at /?
ANSWER FOUND AT
.net web application change root directory
I don't know why the angular site does not mention that.
Try to add base tag:
The tag specifies the base URL/target for all relative URLs in
a document
.
http://www.w3schools.com/tags/tag_base.asp
ANSWER FROM
.net web application change root directory
<configuration>
<system.web>
...
<urlMappings enabled="true">
<add url="~/" mappedUrl="~/src/index.html" />
</urlMappings>
</system.web>
...
<system.webServer>
...
<rewrite>
<rules>
<rule name="Redirect everything to root" 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="/src/{R:0}" />
</rule>
</rules>
</rewrite>
</system.webServer>
...
</configuration>
Have you marked your index.html as application start up page?
If not, right click on index.html and click on "Set As Start Page".

Web.Config causes 500 internal server error

This is my web.config file contents:
<?xml version="1.0"?>
<configuration>
<system.webServer>
<httpErrors errorMode="Detailed" />
<asp scriptErrorSentToBrowser="true"/>
<rewrite>
<rules>
<rule name="Main Rule" 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="index.php" />
</rule>
</rules>
</rewrite>
</system.webServer>
<system.web>
<customErrors mode="Off"/>
<compilation debug="true"/>
</system.web>
</configuration>
I'm trying to use pretty permalinks of wordpress.
But this web.config files causes 500 Internal Server Error.
What is the problem?
The problem was from the server, they have not installed Microsoft URL Rewriting Module correctly...
The module has been installed correctly, and then problem solved.
The answer provided by Mahdi is correct. However, if you are unable to install the URL Rewrite module (which was the problem I had due to some signature verification problem), you can download an older version of the module from the link provided below. This ended up working for me.
Hope this helps.
https://forums.iis.net/t/1239468.aspx?URL+rewrite+installation+failing+due+to+signature+verification+failure

Resources