1
我有下面的代碼轉發到時工作正常我localhost:1671
:DelegatingHandler工作在本地主機,但不能在Azure上
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
你能更具體一些嗎,你是什麼意思的「它不工作」?沒有開始,沒有迴應請求,例外,......? – Lanorkin
我收到了404網站未找到。 – user3362714