我的重写规则给了我500.怎么了?

时间:2014-05-25 17:12:37

标签: xml web-config

当我向Web.config添加新规则时,我收到HTTP 500错误。我在Azure上。

以下是错误消息:

<rule name="Rewrite ticket and segment" stopProcessing="true">
    <match url="^([A-Z]{3}[0-9]{4}[A-Z]{1}[0-9]{4})\/([0-9]{1,5})\/?" />
    <action type="Rewrite" url="/api/getTicket.php?ticketId={R:1}&segment={R:2}" />
</rule>

但是这个正在工作

<rule name="Rewrite ticket" stopProcessing="true">
    <match url="^([A-Z]{3}[0-9]{4}[A-Z]{1}[0-9]{4})\/?" />
    <action type="Rewrite" url="/api/getTicket.php?ticketId={R:1}" />
</rule>

1 个答案:

答案 0 :(得分:2)

原因是,您的XML无效。由于基于web.config XML & &不是您的想法。

&amp;更改为<rule name="Rewrite ticket and segment" stopProcessing="true"> <match url="^([A-Z]{3}[0-9]{4}[A-Z]{1}[0-9]{4})\/([0-9]{1,5})\/?" /> <action type="Rewrite" url="/api/getTicket.php?ticketId={R:1}&amp;segment={R:2}" /> </rule> ,它会有效。

{{1}}
相关问题