更新后正则表达式过于复杂引起的HTTP错误500.50

时间:2019-07-02 14:31:16

标签: visual-studio url-rewriting iis-express visual-studio-2019 url-rewrite-module

在运行Windows 10和Visual Studio 2019的某些Dev-Machines上,我们遇到一个奇怪的问题。无法再调试MVC网站,因为无法加载多个资源(CSS,JS)。资源全部显示:

HTTP Error 500.50 - URL Rewrite Module Error

The expression "^\/(([\(\)\.\-\/_äöüßA-Za-z0-9\s]*)+)(\+(([\.\-_äöüßA-Za-z0-9\s])*))(\+(([\.\-_äöüßA-Za-z0-9\s])*))(\+(([\.\-_äöüßA-Za-z0-9\s])*))(\+(([\.\-_äöüßA-Za-z0-9\s])*))" failed to match because it was too complex.

未对web.config或重写规则进行任何更改。这些规则现在已经“太复杂了”,已经存在多年了。

所以我认为它必须与Visual Studio 2019或Windows Update相关。 在运行Windows 1803和VS 16.0.3的开发机上,它仍然可以运行,装有Win 1809和VS 16.1.3以及Win 1903和VS 16.1.4的计算机已损坏。

我仍然并行安装了VS 2017,但是它也是新的,所以这真的与Windows版本有关吗?

我不认为规则是问题,因为它们已经使用了多年,但是为了完整性,这里是有问题的规则:

        <rule name="seachingmagazineD" stopProcessing="true">
          <match url="(.*)" />
          <conditions logicalGrouping="MatchAll" trackAllCaptures="false">
            <add input="{URL}" pattern="^\/(([\(\)\.\-\/_äöüßA-Za-z0-9\s]*)+)(\+(([\.\-_äöüßA-Za-z0-9\s])*))(\+(([\.\-_äöüßA-Za-z0-9\s])*))(\+(([\.\-_äöüßA-Za-z0-9\s])*))(\+(([\.\-_äöüßA-Za-z0-9\s])*))" />
          </conditions>
          <action type="Redirect" url="/{C:1} {C:4} {C:7} {C:10} {C:13}" />
        </rule>
        <rule name="seachingmagazineC" stopProcessing="true">
          <match url="(.*)" />
          <conditions logicalGrouping="MatchAll" trackAllCaptures="false">
            <add input="{URL}" pattern="^\/(([\(\)\.\-\/_äöüßA-Za-z0-9\s]*)+)(\+(([\.\-_äöüßA-Za-z0-9\s])*))(\+(([\.\-_äöüßA-Za-z0-9\s])*))(\+(([\.\-_äöüßA-Za-z0-9\s])*))" />
          </conditions>
          <action type="Redirect" url="/{C:1} {C:4} {C:7} {C:10}" />
        </rule>
        <rule name="seachingmagazineB" stopProcessing="true">
          <match url="(.*)" />
          <conditions logicalGrouping="MatchAll" trackAllCaptures="false">
            <add input="{URL}" pattern="^\/(([\(\)\.\-\/_äöüßA-Za-z0-9\s]*)+)(\+(([\.\-_äöüßA-Za-z0-9\s])*))(\+(([\.\-_äöüßA-Za-z0-9\s])*))" />
          </conditions>
          <action type="Redirect" url="/{C:1} {C:4} {C:7}" />
        </rule>
        <rule name="seachingmagazineA" stopProcessing="true">
          <match url="(.*)" />
          <conditions logicalGrouping="MatchAll" trackAllCaptures="false">
            <add input="{URL}" pattern="^\/(([\(\)\.\-\/_äöüßA-Za-z0-9\s]*)+)(\+(([\.\-_äöüßA-Za-z0-9\s])*))" />
          </conditions>
          <action type="Redirect" url="/{C:1} {C:4}" />
        </rule>

由于我没有在互联网上找到有关此特定错误消息的任何内容,也许有人已经遇到了相同的问题或有想法?

每次调试时都将有问题的行注释掉确实很烦人。而且恐怕这可能是一项常规设置更改,一段时间后它会进入生产环境,即Azure上的IIS设置...

0 个答案:

没有答案