cURL路径在IIS7中不起作用


cURL path not working in IIS7

我正试图通过cURLIIS7中发布数据。我的代码在cakePHP中。

我在本地主机上安装了IIS,端口为8090,并给出了cURL的URL,如下所示,运行良好:

http://localhost:8090/project/project_name/test_post

我的问题是,我将相同的代码部署到IIS的其他没有端口的系统。

所以我把URL改成:

http://localhost/project/project_name/test_post

但由于"localhost"不起作用,我收到错误。

这是怎么回事?

我该如何解决此问题?

嗨,

cakeHP中的端口是否在其他系统的IIS 7中正确配置?IIS 7是否使用正确的php版本运行?本地主机上IIS7上是否安装了数据库?IIS 7上是否启用了mod_rewrite?IIS 7中的web.config是否已更改?

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <rewrite>
            <rules>
                <rule name="Exclude direct access to webroot/*"
                  stopProcessing="true">
                    <match url="^webroot/(.*)$" ignoreCase="false" />
                    <action type="None" />
                </rule>
                <rule name="Rewrite routed access to assets(img, css, files, js, favicon)"
                  stopProcessing="true">
                    <match url="^(img|css|files|js|favicon.ico)(.*)$" />
                    <action type="Rewrite" url="webroot/{R:1}{R:2}"
                      appendQueryString="false" />
                </rule>
                <rule name="Rewrite requested file/folder to index.php"
                  stopProcessing="true">
                    <match url="^(.*)$" ignoreCase="false" />
                    <action type="Rewrite" url="index.php"
                      appendQueryString="true" />
                </rule>
            </rules>
        </rewrite>
    </system.webServer>
</configuration>

也许您必须使用正确的配置设置在IIS 7服务器上重建cakeApp。

 class DATABASE_CONFIG {
        public $default = array(
            'datasource'  => 'Database/Mysql',
            'persistent'  => false,
            'host'        => 'localhost',
            'port'        => '8080'
            'login'       => 'cakephpuser',
            'password'    => 'c4k3roxx!',
            'database'    => 'my_cakephp_project',
            'prefix'      => ''
        );
}

如果有类似的东西,请检查你的cakeApp:

$request = array(
    'method' => 'POST',
    'uri' => array(
        'scheme' => 'http',
        'host' => $notificationUrl,
        'port' => 8080,

向致以最良好的问候

Axel Arnold Bangert-Herzogenrath 2016