简体   繁体   English

设置代理Windows IOT核心

[英]Setting Proxy Windows IOT Core

I am working on a project with a raspberry 2 with windows iot core. 我正在开发一个带有windows iot核心的覆盆子2的项目。 Where i need to send data to a Swagger api, but the corporate proxy on my location blocks the messages. 我需要将数据发送到Swagger api,但我所在位置的公司代理阻止了这些消息。 I can't find any clear solution on how to bypass or use the proxy for iot core. 我找不到任何有关如何绕过或使用iot核心代理的明确解决方案。 Here is my base code for sending data to the api, it works outside the proxy but not in it. 这是我将数据发送到api的基本代码,它在代理外部工作,但不在其中。

public async void sender(string link, object value)
{

    string jsonData = JsonConvert.SerializeObject(value);

    var client = new HttpClient();

    try
    {
        var response = (await client.PostAsync(link, new StringContent(jsonData, 
                                           Encoding.UTF8, "application/json")));
        System.Diagnostics.Debug.WriteLine(response);
    }
    catch (Exception ex)
    {
        System.Diagnostics.Debug.WriteLine(ex);
    }

}

Have you tried using PowerShell to manually set the gateway IP address for the network connection to something other than that of the proxy server (which I assume DHCP is providing)? 您是否尝试过使用PowerShell手动将网络连接的网关IP地址设置为代理服务器的网关IP地址(我假设DHCP正在提供)?

Something like this: 像这样的东西:

$adapter = Get-NetAdapter `
    -Name Ethernet

New-NetIPAddress `
    -InterfaceAlias $adapter.Name `
    -AddressFamily IPv4 `
    -IPAddress 192.168.1.55 `
    -PrefixLength 24 `
    -DefaultGateway 192.168.1.1; 

Set-DnsClientServerAddress `
    -InterfaceAlias $adapter.Name `
    -ServerAddresses ("192.168.1.2","192.168.1.3")

Use the IoT Dashboard app to create a PowerShell session to your device. 使用IoT Dashboard应用程序为您的设备创建PowerShell会话。 It just handles setting up the remote service commands for you. 它只是处理为您设置远程服务命令。

If you not familiar with doing that check out the IoT Dashboard section here: 如果您不熟悉,请查看此处的IoT Dashboard部分:

http://www.purplefrogsystems.com/paul/2016/06/controlling-your-windows-10-iot-core-device/ http://www.purplefrogsystems.com/paul/2016/06/controlling-your-windows-10-iot-core-device/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM