私はAzureでサービスファブリッククラスタをセットアップし、2つのサービスを実行しているアプリケーションを持っています。今私はlocalhost上で実行できるように、ブラウザのサービスに接続できるようにしたい。 アプリケーションはOwinとSwaggerを使用します。 localhostでの実行方法は次のとおりです。running on localhost Azureから接続しようとすると、タイムアウトエラーが発生します。アプリケーションでポート20002と20001を使用しています。クラスタを設定すると(ポート19000,19080,20001,20002がクラスタ内で開いています)、ポートを開いています。エクスプローラでの私のサービスはService in the explorerです。クラスタに証明書のセキュリティが設定されています。証明書がブラウザに追加されています(エクスプローラに接続するために使用しています)。 CreateServiceInstanceListenersのための私のコード:サービスファブリックアプリケーションエンドポイントに接続
protected override IEnumerable<ServiceInstanceListener> CreateServiceInstanceListeners()
{
return Context.CodePackageActivationContext.GetEndpoints()
.Where(endpoint => endpoint.Protocol.Equals(EndpointProtocol.Http) || endpoint.Protocol.Equals(EndpointProtocol.Https))
.Select(endpoint => new ServiceInstanceListener(serviceContext => new OwinCommunicationListener("", new Startup(), serviceContext)));
}
メソッドおよびopenAsyncのための私のコード:
public OwinCommunicationListener(string appRoot, IOwinAppBuilder startup, StatelessServiceContext serviceInitializationParameters)
{
_startup = startup;
_appRoot = appRoot;
_parameters = serviceInitializationParameters;
}
public Task<string> OpenAsync(CancellationToken cancellationToken)
{
var serviceEndpoint =
_parameters
.CodePackageActivationContext
.GetEndpoint("ServiceEndpoint");
var port = serviceEndpoint.Port;
var root =
String.IsNullOrWhiteSpace(_appRoot)
? String.Empty
: _appRoot.TrimEnd('/') + '/';
//TODO: Make localhost configable
_listeningAddress = String.Format(
CultureInfo.InvariantCulture,
"http://+:{0}/{1}",
port,
root
);
_serverHandle = WebApp.Start(
_listeningAddress,
appBuilder => _startup.Configuration(appBuilder)
);
var publishAddress = _listeningAddress.Replace(
"+",
FabricRuntime.GetNodeContext().IPAddressOrFQDN
);
ServiceEventSource.Current.Message("Listening on {0}", publishAddress);
return Task.FromResult(publishAddress);
}
と私のServiceEndpoint:
<Endpoints>
<Endpoint Name="ServiceEndpoint" Port="20002" />
</Endpoints>
私の質問総括する:どのように私は私のサービスファブリックアプリケーションをアクセスもできます私のブラウザのサービスは、すごく使いましたか?
フォワードの内部ポートに(任意の)外部ポートでありますロードバランサ上の20002 – Mardoxx