0

I'm trying to run slim application in IIS, I add it as Application in default web sites, I've imported rules from .htaccess and updated physical address to public, but I still got Page Not Found to be noticed that when I add it as a Web site ( not in Default web site ) it works! But I need to run it inside Default website to can access it using public IP over the network. enter image description here

here is web.config file

<?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="IsDirectory" ignoreCase="false" negate="true" />
                        <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>

Any suggestion is much appreciated!

Kenana Reda
  • 430
  • 1
  • 9
  • 24

2 Answers2

0

If you want to directly use the publich IP address without adding port(That means useing 80 port), you should modify the Default web site's port without using 80 and add 80 port binding for your new web site.

Details,you could refer to below steps:

1.Open the IIS management console, right click the Default Web Site and click the edit bindings.

2.Select the 80 port binding and modify it to another port.

enter image description here

3.Open the other web application, and add 80 port binding to it.

Brando Zhang
  • 22,586
  • 6
  • 37
  • 65
0

The reason behind the error was caused by additional settings that were added previously to get slim app working in Apache server in dependencies.php file

    $container['environment'] = function () {
     // Fix the Slim 3 subdirectory issue (#1529)
     // This fix makes it possible to run the app from localhost/slim3-app
     $scriptName = $_SERVER['SCRIPT_NAME'];
     $_SERVER['REAL_SCRIPT_NAME'] = $scriptName;
     $_SERVER['SCRIPT_NAME'] = dirname(dirname($scriptName)) . '/' . basename($scriptName);
     return new Slim\Http\Environment($_SERVER);
   };

by removing it and check project permissions, I got it working!

Kenana Reda
  • 430
  • 1
  • 9
  • 24