我已经设置了Azure Batch帐户,并尝试使用此处的C#HelloWorld示例,
https://github.com/Azure/azure-batch-samples
在AccountSettings.settings中填写批处理和存储帐户详细信息后,如果我在公司网络之外(在代理服务器后面),这可以正常工作。但是,当我从代理服务器后面使用完全相同的代码时,
BatchException: Operation returned an invalid status code 'Forbidden'
并在控制台中输出以下内容,
C:\Source\Scratch\Azure-batch-samples\CSharp\GettingStarted\01_HelloWorld\bin\Debug>HelloWorld.exe
Running with the following settings:
-------------------------------------
PoolId = HelloWorld-Pool
PoolTargetNodeCount = 2
PoolOSFamily = 4
PoolNodeVirtualMachineSize = small
ShouldDeleteJob = True
BatchAccountName = <censored>
BatchAccountKey = <censored>
BatchServiceUrl = <censored>
StorageAccountName = <censored>
StorageAccountKey = <censored>
StorageServiceUrl = <censored>
Deleting job: HelloWorldJob-809362-20180126-143309
Microsoft.Azure.Batch.Common.BatchException: Operation returned an invalid status code 'Forbidden' ---> Microsoft.Azure.
Batch.Protocol.Models.BatchErrorException: Operation returned an invalid status code 'Forbidden'
at Microsoft.Azure.Batch.Protocol.JobOperations.<DeleteWithHttpMessagesAsync>d__6.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
<..snip..>
Request Information
ClientRequestId:
RequestId:d8b9fcc6-b32d-437c-a8af-7d44d6df486d
HttpStatusCode:Forbidden
StatusMessage:Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly
including the signature.
Error Code = AuthenticationFailed, Lang=en-US, Message = Server failed to authenticate the request. Make sure the value
of Authorization header is formed correctly including the signature.
RequestId:d8b9fcc6-b32d-437c-a8af-7d44d6df486d
Time:2018-01-26T13:33:13.9958126Z
Additional Values:
Error Details key=AuthenticationErrorDetail value=The MAC signature found in the HTTP request 'k4mfqD3FP6FL2nWLgR3E6AxRp
JJAse9vRW1qVOnn1K0=' is not the same as any computed signature. Server used following string to sign: 'DELETE
有谁知道这里发生了什么?
答案 0 :(得分:2)
似乎只有very similar issue只影响了.NET Core,但它在7.0.1中修复了,我假设您使用的是8.0.1?
我要做的第一件事是验证(使用Fiddler或Wireshark)流量确实通过您认为的代理。
如果没有,则可能值得尝试BatchClient
ctor采用BatchServiceClient
(通过传递BatchServiceClient
HttpClientHandler
来创建Proxy
的实例根据需要设置属性)。
失败 - 您实际上需要从公司代理服务器后面访问批处理服务吗?我的猜测是,无论您想要实际使用批处理服务,都将包含在一个API或Web应用程序中,该应用程序本身将部署到Azure - 因此不需要HTTP代理!