我有以下代码在转发到我时可以正常工作localhost:1671
:
protected override async System.Threading.Tasks.Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, System.Threading.CancellationToken cancellationToken)
{
UriBuilder forwardUri = new UriBuilder(request.RequestUri);
//remove the proxy port and replace with an Http port
forwardUri.Port = 1671;
//send it on to the requested URL
request.RequestUri = forwardUri.Uri;
HttpClient client = new HttpClient();
if (request.Method == HttpMethod.Get)
request.Content = null;
try
{
var response = await client.SendAsync(request, HttpCompletionOption.ResponseHeadersRead);
if (response.StatusCode == HttpStatusCode.OK)
{
ManageOnline(response.RequestMessage);
}
return response;
}
catch (Exception ex)
{
throw;
}
}
但是,当我将其更改为我在 azure 上的网站(例如 xxxx.azurewebsites.net)时,它不起作用。
知道我是否需要对 Azure 进行不同的配置吗?我假设在 Azure 上的端口是 80。