使用服务工厂在IIS 7上使用WCF服务的Wordpress Permalinks
假设您在IIS 7上托管Wordpress,并且希望激活永久链接。查看codex,您将看到web.config文件(位于WordPress安装的根目录下)的示例代码添加到使用服务工厂在IIS 7上使用WCF服务的Wordpress Permalinks,wordpress,wcf,iis,permalinks,Wordpress,Wcf,Iis,Permalinks,假设您在IIS 7上托管Wordpress,并且希望激活永久链接。查看codex,您将看到web.config文件(位于WordPress安装的根目录下)的示例代码添加到标记中: <rewrite> <rules> <rule name="Main Rule" stopProcessing="true"> <match url=".*" /> <conditions lo
标记中:
<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>
导航到AccountService.svc将导致找不到404
你如何处理这种情况?下面我已经发布了我的具体解决方案,但还有其他方法可以实现这一点。另外,一般情况下的解决方案仍然很难找到,因此问题仍然存在,您如何一般地处理这种情况?下面我作为URL重写领域的一名新手提供了我的解决方案。解决方案特定于特定文件夹 要解决我的问题,有必要在重写规则中添加一个附加条件:
<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" />
<add input="{REQUEST_URI}" pattern="^/Services/.*" negate="true" />
</conditions>
<action type="Rewrite" url="index.php" />
</rule>
</rules>
</rewrite>
如果不完整,则具有指导意义
<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" />
<add input="{REQUEST_URI}" pattern="^/Services/.*" negate="true" />
</conditions>
<action type="Rewrite" url="index.php" />
</rule>
</rules>
</rewrite>
<rule name="ignoreSubDirectoryURIs" stopProcessing="true">
<match url="(.*)/.*\..*" ignoreCase="false" />
<conditions>
<add input="{APPL_PHYSICAL_PATH}\{R:1}\" matchType="IsDirectory" />
</conditions>
<action type="None" />
</rule>