【问题标题】:Add the web service reference but cannot see it in object browser and the client class is not generated添加 Web 服务引用但在对象浏览器中看不到它并且未生成客户端类
【发布时间】:2016-03-17 14:38:04
【问题描述】:

我试图在 VS Express 2013 中将一些 wcf 服务添加到我的控制台应用程序。我成功地将所有服务添加到 Web 引用。对于来自第三方的一些服务,我可以在对象浏览器中看到它们并且生成了客户端类。对于我创建的服务,我在对象浏览器中看不到它们,也没有生成客户端类。我阅读了这些(https://social.msdn.microsoft.com/Forums/en-US/d2bc41df-20ee-4fc1-9807-1cd21dee37f6/can-add-web-service-reference-but-cannot-see-it-in-object-browser-or-use-itWhy, when adding a service reference in VS2010, is the client class not generated?)和其他帖子,但仍然无法正常工作。以下是有问题的服务的代码:

IFileProviderService.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;
using System.IO;
using System.ServiceModel.Web;

namespace MyServices
{
    [ServiceContract]
    public interface IFileProviderService
    {
        [OperationContract]
        [WebGet(UriTemplate = "/AppInstaller/{userID}/{fileName}/{os}")]
        Stream AppInstaller(string userID, string fileName, string os);
    }
}

FileProviderService.svc.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;
using System.IO;
using System.ServiceModel.Web;
using System.ServiceModel.Activation;

namespace MyServices
{
    [AspNetCompatibilityRequirements(RequirementsMode =     AspNetCompatibilityRequirementsMode.Allowed)]
    public class FileProviderService : IFileProviderService
    {
        public Stream AppInstaller(string userID, string fileName, string os)
        {
        ......

        }
    }
}

参考.cs

#pragma warning disable 1591

namespace ServiceTest.MyFileProviderService {

}

#pragma warning restore 1591

此服务正在运行并正常运行。 任何帮助表示赞赏。

【问题讨论】:

    标签: c# asp.net .net web-services wcf


    【解决方案1】:

    问题已解决。事实证明,服务必须是“basicHttpBinding”才能从客户端访问。见Can't get WCF service's operations list with Web Service Studio client

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-03-01
      • 2018-07-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-09-09
      • 2012-05-19
      相关资源
      最近更新 更多