Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/azure/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Azure服务结构的信号R握手失败_Azure_Flutter_Dart_Signalr_Azure Service Fabric - Fatal编程技术网

Azure服务结构的信号R握手失败

Azure服务结构的信号R握手失败,azure,flutter,dart,signalr,azure-service-fabric,Azure,Flutter,Dart,Signalr,Azure Service Fabric,我们有一个Flatter Dart客户端应用程序,它必须与Service Fabric Microservice集成 客户端代码无法与信号R建立连接,在进一步调试客户端代码时,我们看到握手请求失败 以下是客户端代码: Future<void> openChatConnection() async { if (_hubConnection == null) { //final logger = attachToLogger(); _hubConne

我们有一个Flatter Dart客户端应用程序,它必须与Service Fabric Microservice集成

客户端代码无法与信号R建立连接,在进一步调试客户端代码时,我们看到握手请求失败

以下是客户端代码:

 Future<void> openChatConnection() async {
    if (_hubConnection == null) {

       //final logger = attachToLogger();
      _hubConnection = HubConnectionBuilder().withUrl(_serverUrl).build();
      _hubConnection.onclose((error) => connectionIsOpen = false);

      _hubConnection.on("OnMessage", _handleIncommingChatMessage);


    }

    if (_hubConnection.state != HubConnectionState.Connected) {
      await _hubConnection.start();
      connectionIsOpen = true;
    }
public class Startup
    {
        public Startup(IHostingEnvironment env)
        {
            IConfigurationBuilder builder = new ConfigurationBuilder();
                // .SetBasePath(env.ContentRootPath)
                // // .AddJsonFile("appsettings.json", optional: false, reloadOnChange: true)
                // // .AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true)
                // .AddEnvironmentVariables();
            this.Configuration = builder.Build();
        }

        public IConfigurationRoot Configuration { get; }

        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            // Add framework services.
            services.AddMvc();
            services.AddSignalR();
        }

        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
        {
            // if (env.IsDevelopment())
            // {
            //     app.UseDeveloperExceptionPage();
            //     app.UseBrowserLink();
            // }
            // else
            // {
            //     app.UseExceptionHandler("/Home/Error");
            // }

            // app.UseStaticFiles();
             app.UseSignalR(routes =>
            {
        routes.MapHub<NotificationClient>("/Chat");
          });

            app.UseMvc(
                routes =>
                {
                    routes.MapRoute(
                        name: "default",
                        template: "{controller=Home}/{action=Index}/{id?}");
                });
            app.UseCors();
        }
    }
}
public class NotificationClient : Hub
  {

    #region Consts, Fields, Properties, Events

    #endregion

    #region Methods

    public void Send(string name, string message)
    {
      // Call the "OnMessage" method to update clients.

      Clients.All.SendCoreAsync("OnMessage", new object[]{name, message});

    }
    #endregion
  }