Web服务正在发送值,但客户端正在获取“INET_E_DOWNLOAD_FAILURE” [英] Web service is sending out value but client is getting "INET_E_DOWNLOAD_FAILURE"

查看:257
本文介绍了Web服务正在发送值,但客户端正在获取“INET_E_DOWNLOAD_FAILURE”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用单一方法创建了一个Web服务,该方法在Windows 10上的IIS中托管。当我使用Postman调用Web服务方法时,我得到"无法获得任何响应"。信息。当我将调试器附加到Web服务并调用它时,我可以看到
该方法被命中并发送回值数组。然而Postman永远不会得到返回值。

I created a web service with a single method which is hosted in IIS on windows 10. when i call the web service method with Postman i get a "Could not get any response" message. When i attach the debugger to the web service and call it, i can see that the method is getting hit and sending back the array of values. Postman however never gets the return values.

interface

interface

    [ServiceContract]
    public interface ISearchService
    {
       
        [OperationContract]
        [WebInvoke(Method = "GET", ResponseFormat = WebMessageFormat.Json,
        BodyStyle = WebMessageBodyStyle.Wrapped, UriTemplate = "Searches")]
        SearchRecord[] GetSearches();

    }

服务实施

        public SearchRecord[] GetSearches()
        {
            return GetAllSearches();
        }

        private SearchRecord[] GetAllSearches()
        {
                IEnumerable<SearchRecord> items = new List<SearchRecord>();
            SearchRecord[] list = null;
            using (SearchProvider ctx = new SearchProvider())
            {
                try
                { 
                items = ctx.Searches;
                list = items.ToArray();
                }
                catch(SqlException ex)
                {
                    System.Diagnostics.Trace.WriteLine(ex.ToString());

                }
                catch(Exception ex)
                {
                    System.Diagnostics.Trace.WriteLine(ex.ToString());

                }
            }
            return list;
        }

我的防火墙已关闭。 "SearchRecord" class使用datacontract属性进行修饰。 

my firewall is turned off. The "SearchRecord" class is decorated with the datacontract attribute. 

Shawn

推荐答案

你从哪里得到这个例子?

Where did you get this example from?


这篇关于Web服务正在发送值,但客户端正在获取“INET_E_DOWNLOAD_FAILURE”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆