0
votes

I'm programming an angularJS single-page application on ASP.net, using signalR to communicate with the server hosted on Windows Server. It works perfectly on IIS express through visual studio, but does not working when deployed on to local IIS (10.0). I've been trying to solve this issue for two days now, and I have gone absolutely nowhere with it. I also use a generated hub proxy. Here's what I've tried:

-Installed ASP.net

-Ensured all IIS/.NET features were installed on Windows Server

-Validated that the Application pool is .net 4.0 Integrated

Here's my startup class:

using System;
using System.Threading.Tasks;
using Microsoft.AspNet.SignalR;
using Microsoft.Owin;
using Owin;

[assembly: OwinStartup(typeof(Quoting.Startup))]
namespace Quoting
{
    public class Startup
    {
        public void Configuration(IAppBuilder app)
        {
            var hubConfiguration = new HubConfiguration();
            hubConfiguration.EnableDetailedErrors = true;
            hubConfiguration.EnableJavaScriptProxies = true;

            app.MapSignalR();
            System.Diagnostics.Debug.WriteLine("SignalR Mapped");
        }
    }
}

I have tried each of the following, plus every possible combination from older versions of MVC which is not what i'm even programming in...

<script src="/signalr/hubs"></script>
<script src="~/signalr/hubs"></script>
<script src="signalr/hubs"></script>
<script src="/hubs"></script>
<script src=".../signalr/hubs"></script>
<script src="{{appname}}/signalr/hubs"></script>

I have this in my web.config:

<system.webServer>
    <validation validateIntegratedModeConfiguration="false" />
    <modules runAllManagedModulesForAllRequests="true">
    </modules>
</system.webServer>

Jquery:

    <script src="Scripts/jquery-3.4.1.js"></script>
    <script src="Scripts/jquery.signalR-2.4.1.min.js"></script>
    <script src="Scripts/jquery.signalR-2.4.1.js"></script>
    <script src="/signalr/hubs"></script> //note: this is what works on IIS express

I'm pretty lost. When I enter in the browser 'localhost:port/signalr/hubs', I get a response on IIS express. However, doing so with my domain, '{domainname}/directory/signalr/hubs' gets 404 not found, and every single combination I can think of will also return 404.

1
Could you please post the IIS web application folder directory? Why you need to use the {domainname}/directory/signalr/hubsuse'? Since the "/signalr/hubs" means the root folder's signlar/hubs folder, you will face the 404 error. If your application is inside a folder, you should use "/directory/signalr/hubs".Brando Zhang
Sure, IIS just points to a single folder, inside that folder are several other directories, one of which is "Supervisor". So trying Supervisor/signalr/hubs does not work. I'll try adding the main directory. As a side note, when I publish the app on visual studio, it doesn't add the OWIN startup.cs file or anything even though it is included on the project. I tried adding it but it doesn't do anything, and I fear it may be calling start in a different way.Gat
Also, the Jquery signalR scripts are found, and the directory structure of the calls looks as expected like they do when run in Visual studio.Gat

1 Answers

0
votes

Solved: My directory structure was listed so that IIS pointed to a folder called "Website", and in this folder I had sub directories for different web apps. When the app is placed in one of these subdirectories, startup.cs is not called when the website is opened. Thus I needed to change my code so that the single page application was simply in the 'Website' folder and could be routed to the seperate apps.