当Appmanifest更改时,Windows App仅连接到REST Api

时间:2016-10-09 12:58:17

标签: c# windows rest vagrant uwp

问题描述

当我在appxmanifest文件上更改随机资料时,我的C#Windows应用程序只能连接到我本地的Testserver的Rest Api(在Virtualbox上)。根本没有什么变化(我试过检查或取消选中横向),在清单更改之后的构建将能够连接,之后的构建将不会。 (并且需要在功能中检查本地网络) 使用我的在线托管服务器,它始终使用相同的代码。 (我只是改变了基础,用户和pw)

错误消息

如果我在点击调试之前没有更改清单,就不能说很多,只是无法连接到服务器。cant connect

Virtualbox Testserver

我使用此Setup来创建Testserver。 (Shopware的Vagrant) enter image description here

我的httpClient代码(使用Windows.Web)

我不认为它与问题相关,但我使用以下codesnippet连接到Rest Api:

    public async Task<string> GET(Uri uri)
    {
        Windows.Web.Http.Filters.HttpBaseProtocolFilter filter =
            new Windows.Web.Http.Filters.HttpBaseProtocolFilter();
        filter.AllowUI = false;

        // Set credentials that will be sent to the server.
        filter.ServerCredential =
            new Windows.Security.Credentials.PasswordCredential(
                uri.ToString(),
                Username,
                Password);

        client = new HttpClient(filter);
        var response = await client.GetAsync(uri);
        var res = await response.Content.ReadAsStringAsync();
        return res;
    }

我是否需要在Visual Studio设置或Virtualbox中更改某些内容? 我可以在Virtualbox中更改某些内容,这样我就不需要在appxmanifest功能中检查“本地网络”吗?

0 个答案:

没有答案