Tiago
Tiago

Reputation: 367

Won't execute signalr/hubs because of ASPX Rewrite

I have a website that uses this rewrite rule in the webconfig

 <rule name="RewriteASPX">
      <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="{R:1}.aspx"/>
    </rule>

I use this rule so the urls work without the ".aspx" extension.

Unfortunately, this is causing the website to be unable to run the signalr/hubs script, and I can't figure out why. Whenever I open the localhost/signalr/hubs" page with this rule enabled, i get "Protocol error: Unknown transport." as result.

error

Is there a rule I can add so I can have this rewrite and still be able to run ths script?

Thank you

Upvotes: 1

Views: 300

Answers (1)

Tiago
Tiago

Reputation: 367

Fixed by adding this condition

<add input="{REQUEST_URI}" pattern="^/(signalr)" negate="true" />

Source: Cannot load signalr hubs file correctly after IIS rewrite (yes, I had done myresearch before, but I was missing out on something)

Upvotes: 1

Related Questions