c#, IIS 10, Web Forms, Forms Authentication, Bootstrap 4, Web API, Trying to Add Signalr - getting 404 on signalr/hubs?

86 views Asked by At

I've used each of the title technologies individually before. It's combining them that's become the issue.

Web App works perfectly on Dev machine with IIS Express (Visual Studio 2019).

When I publish, no SignalR. if I try to navigate to webaddress.com/signalr/hubs I get a 404 error.

the #1 fix: <modules runAllManagedModulesForAllRequests="true">

  • this "fixes" Signalr. but then there is no bootstrap on the pages and the <remove name="ExtensionlessUrlHandler-Integrated-4.0" /> to fix the URL without Default.aspx, gets broken as well.

So I'm guessing there is a "module" that i have to use to get Signalr to work again and the "run allmanagedmodules" is too generic?

Here's my Web Config. Any Ideas?

<configuration>
  <configSections>
    <sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
      <section name="XXXXXXXXX.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
    </sectionGroup>
  </configSections>
  <connectionStrings>
    <add name="XXXXXXXXXX" connectionString="Data Source=XXXXXXX\SQLEXPRESS;Initial Catalog=XXXXXXX;Integrated Security=false;user=XXXXXXX;password=XXXXXXX" />
  </connectionStrings>
  <system.web>
    <customErrors mode="Off" />
    <compilation targetFramework="4.6" debug="true" />
    <httpRuntime targetFramework="4.6" />
    <authentication mode="Forms">
      <forms loginUrl="login.aspx" name=".ASPNETAUTH" protection="None" path="/" defaultUrl="default.aspx" timeout="30" />
    </authentication>
    <authorization>
      <deny users="?" />
      <allow users="*" />
    </authorization>
  </system.web>
  <location path="Default.aspx">
    <system.web>
      <authorization>
        <allow users="*" />
      </authorization>
    </system.web>
  </location>
  <location path="signalr">
    <system.web>
      <authorization>
        <allow users="*" />
      </authorization>
    </system.web>
  </location>
  <location path="Patient.aspx">
    <system.web>
      <authorization>
        <allow users="*" />
      </authorization>
    </system.web>
  </location>
  <location path="aboutus.aspx">
    <system.web>
      <authorization>
        <allow users="*" />
      </authorization>
    </system.web>
  </location>
  <location path="contact.aspx">
    <system.web>
      <authorization>
        <allow users="*" />
      </authorization>
    </system.web>
  </location>
  <location path="iforgot.aspx">
    <system.web>
      <authorization>
        <allow users="*" />
      </authorization>
    </system.web>
  </location>
  <location path="test.aspx">
    <system.web>
      <authorization>
        <allow users="*" />
      </authorization>
    </system.web>
  </location>
  <location path="api/XXXX">
    <system.web>
      <authorization>
        <allow users="*" />
      </authorization>
    </system.web>
  </location>
  <system.codedom>
    <compilers>
      <compiler language="c#;cs;csharp" extension=".cs" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=2.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:default /nowarn:1659;1699;1701" />
      <compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.VBCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=2.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:default /nowarn:41008 /define:_MYTYPE=\&quot;Web\&quot; /optionInfer+" />
    </compilers>
  </system.codedom>
  <applicationSettings>
    <XXXXXXX.Properties.Settings>
      <setting name="UserID" serializeAs="String">
        <value>XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX</value>
      </setting>
      <setting name="FromEmail" serializeAs="String">
        <value>[email protected]</value>
      </setting>
      <setting name="EmailUsername" serializeAs="String">
        <value>xxxxxxxxxxxxxxxxxx\xxxxxxxxxxxxxxxx</value>
      </setting>
      <setting name="EmailPassword" serializeAs="String">
        <value>XXXXXXXXXX</value>
      </setting>
      <setting name="EmailServer" serializeAs="String">
        <value>mail.XXXXXXXXXXXXXXXXXXX.com</value>
      </setting>
      <setting name="Token" serializeAs="String">
        <value>XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX</value>
      </setting>
    </XXXXXXX.Properties.Settings>
  </applicationSettings>
  <system.webServer>
    <modules >
      <remove name="UrlRoutingModule-4.0" />
      <add name="UrlRoutingModule-4.0" type="System.Web.Routing.UrlRoutingModule" preCondition="" />

      <!-- any other modules you want to run in MVC e.g. FormsAuthentication, Roles etc. -->

    </modules>
    <handlers>
      <remove name="ExtensionlessUrlHandler-Integrated-4.0" />
    </handlers>
    <rewrite>
      <rules>
        <rule name="HTTPS force" enabled="true" stopProcessing="true">
          <match url="(.*)" />
          <conditions>
            <add input="{HTTPS}" pattern="^OFF$" />
          </conditions>
          <action type="Redirect" url="https://{HTTP_HOST}{REQUEST_URI}" redirectType="Permanent" />
        </rule>
      </rules>
    </rewrite>
  </system.webServer>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="12.0.0.0" />
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
</configuration>

0

There are 0 answers