CosmosDB C# SDK ProyUrl missing

拈花ヽ惹草 提交于 2019-12-11 19:37:09

问题


I am working on a containerized micro-services project (docker) in .NET Core targeting Azure. So we are using Azure Cosmos DB, and the C# Cosmos DB SDK (v2.4 since v3 is only in preview) for the CoreSql Api.

During development, I am behind a proxy, so I need to specify the proxy url for everything going outside. It works fine with HttpClientHandler for any HttpClient.

Using Cosmos DB SDK, I however don't see how to set this up on my DocumentClient.

In the Azure Node SDK, I see I could just create a ConnectionPolicy and set the ProxyUrl property for this purpose: https://docs.microsoft.com/en-us/javascript/api/%40azure/cosmos/connectionpolicy?view=azure-node-latest#proxyurl

However, in the C# variant, no ProxyUrl: https://docs.microsoft.com/en-us/dotnet/api/microsoft.azure.documents.client.connectionpolicy?view=azure-dotnet

Is there another way to set that? It is a missing feature in Cosmos DB SDK? Thanks! Eric


回答1:


You can try setting in the config file like below:

<system.net>
    <defaultProxy enabled="true" useDefaultCredentials="true">
        <proxy usesystemdefault="True" />
    </defaultProxy>
</system.net>

Alternatively ,you can use HttpMessageHandler class as mentioned by @Matias.



来源:https://stackoverflow.com/questions/56153665/cosmosdb-c-sharp-sdk-proyurl-missing

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!