none
请问为啥调用局域网用ASP.NET MVC写的东西时会报错 RRS feed

  • 问题

  • 拒绝访问。

    A network capability is required to access this network resource

     public async static Task< Rootobject> GetWeather( double lat,double lon)
            {
                Windows.Web.Http.HttpClient http = new Windows.Web.Http.HttpClient();
                //var http = new HttpClient();
                var response = await http.GetAsync(new Uri( "http://192.168.0.5:18001/MainContent/GetZhaoBiaoList?PageNumber=1&PageSize=100&StartTime=&EndTime=&Title=&PublishTypeModel=&Area="));
       

                var result = await response.Content.ReadAsStringAsync();
                var serializer =new DataContractJsonSerializer(typeof(Rootobject));

                var ms = new MemoryStream(Encoding.UTF8.GetBytes(result));

                var data =(Rootobject) serializer.ReadObject(ms);
                return data;
            }


    • 已编辑 彭123 2019年8月14日 8:37
    2019年8月14日 8:36

答案

  • 你好,

    请问是UWP 应用吗? 如果是的话请你检查一下你的internet capabilities.


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    • 已标记为答案 彭123 2020年7月6日 3:18
    2019年8月15日 3:22