当我在appxmanifest文件上更改随机资料时,我的C#Windows应用程序只能连接到我本地的Testserver的Rest Api(在Virtualbox上)。根本没有什么变化(我试过检查或取消选中横向),在清单更改之后的构建将能够连接,之后的构建将不会。 (并且需要在功能中检查本地网络) 使用我的在线托管服务器,它始终使用相同的代码。 (我只是改变了基础,用户和pw)
如果我在点击调试之前没有更改清单,就不能说很多,只是无法连接到服务器。
我使用此Setup来创建Testserver。 (Shopware的Vagrant)
我不认为它与问题相关,但我使用以下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功能中检查“本地网络”吗?