Tag: wcf binding

一个流中的多个流不会正确传递给客户端

在WCF服务中,我根据这个问题填写Stream,如: result.Stream = new MemoryStream(); BinaryWriter writer = new BinaryWriter(result.Stream); foreach (string fileN in zipFiles) { byte[] fileBytes = File.ReadAllBytes(fileN); writer.Write(BitConverter.GetBytes(fileBytes.Length), 0, 4); writer.Write(fileBytes, 0, fileBytes.Length); } writer.Flush(); return result; 在此之前我通过这个返回流,一切都在服务和客户端: result.Stream = new MemoryStream(File.ReadAllBytes(fileN)); Stream是MessageBodyMember但现在更改它以将所有文件保存在一个流中。 和客户端的测试方法: ExportClient export = new ExportClient(“exportEndPoint”); ExportResult_C result = export.Export(source); result.Stream.Position = 0; //result.Stream.SaveToFile(“d:\\kkk.log”); BinaryReader reader = new BinaryReader(result.Stream, […]

如何在2.0内置的应用程序中使用WCF wsHttpBinding服务?

WCF服务使用’wsHttpBinding’绑定运行。 将使用WCF服务的应用程序是非wcf合规性的,换句话说,它位于Framework 2.0的顶部,我不能在此应用程序中使用ServiceModel(因为只有3.5支持ServiceModel)。 任何建议,如何在2.0内置的应用程序中使用上面的WCF服务?

C#WCF:WCF服务在发送项目数组时返回(404)错误请求

我试图将一个大约50个元素的数组发送到WCF服务方法,但我总是收到(404) Bad Request错误。 我认为它与消息大小或类似的东西有关,因为如果我发送一个空数组它可以工作。 我做了一些研究,并在WCF的web.config中添加了一些东西,但我仍然无法让它工作。 任何人都可以提供一些额外的信息,我可以如何增加我可以发送的邮件的大小 ? [更新]解决方案: 解

使用NetTcpBinding的WCF服务库

我在使用NetTcpBinding时遇到了困难。 当我运行我的WCF服务时,我得到了这个: System.InvalidOperationException: Could not find a base address that matches scheme net.tcp for the endpoint with binding NetTcpBinding. Registered base address schemes are [http]. at System.ServiceModel.ServiceHostBase.MakeAbsoluteUri(Uri relativeOrAbsoluteUri, Binding binding, UriSchemeKeyedCollection baseAddresses) at System.ServiceModel.Description.ConfigLoader.LoadServiceDescription(ServiceHostBase host, ServiceDescription description, ServiceElement serviceElement, Action`1 addBaseAddress) at System.ServiceModel.ServiceHostBase.LoadConfigurationSectionInternal(ConfigLoader configLoader, ServiceDescription description, ServiceElement serviceSection) at System.ServiceModel.ServiceHostBase.LoadConfigurationSectionInternal(ConfigLoader configLoader, ServiceDescription description, String configurationName) […]

使用NetTCPBinding回调

NetTCPBinding是否支持回调? 如果是这样,请将我重定向到任何适当的示例。 谢谢

Net TCP绑定:无法识别URI前缀

这真的让我困扰了几个小时。 我使用TCP绑定创建了最简单的WCF服务。 namespace WcfTcpService { public class TestTcpService : ITestTcpService { public string Hello(string name) { return “Hello, ” + name + “!”; } } } namespace WcfTcpService { [ServiceContract] public interface ITestTcpService { [OperationContract] string Hello(string name); } } Web.config文件包含以下部分: <!– –> <!—-> 此服务托管在IIS中: 现在,当尝试从客户端应用程序添加对net.tcp://localhost:808/WcfTcpService.TestTcpService的引用时,我一直收到错误: The URI prefix is not recognized. Metadata contains a […]

使用单个控制台应用程序托管两个WCF服务

我试图使用一个控制台应用程序托管两个服务。 但是,当我尝试这样做时,只有一个服务被托管,而另一个服务没有。 Program.cs中: namespace WWWCFHost { class Program { static void Main(string[] args) { using (ServiceHost host = new ServiceHost(typeof(WWWCF.Login))) { host.Open(); Console.WriteLine(“Service1 Started”); } using (ServiceHost host1 = new ServiceHost(typeof(WWWCF.UserRegistration))) { host1.Open(); Console.WriteLine(“Service2 Started”); Console.ReadLine(); } } } } App.config中 在上面的代码中,我试图在端口8080上托管一个服务,而另一个在端口8090上托管。当我运行应用程序时,第一个服务启动然后自动关闭,第二个服务仍然启动。 如何同时托管这两项服务? 我已经浏览了这个链接: 两个WCF服务,托管在一个控制台应用程序中 我也经历过其他线索。但他们没有解决我的问题。 如果需要,将很乐意提供任何进一步的细节。

(413请求实体太大

我有WCF服务,当我想将参数作为大字符串传递时,我有一个方法(超过1mb) 我运行此wcf并在WCF测试客户端中更改了配置,如下所示: 当我尝试调用此方法时,我仍然有413请求实体太大。

在WCF服务中公开webHttpBinding端点

我创建了一个WCF服务并公开了三个端点,即basicHttpBinding,wsHttpBinding和webHttpBinding。 这是我使用WCF进行实验的测试服务。 但是,每当我使用.svc文件添加服务引用时,我只获得两个(基本和ws)端点。 由于某种原因,似乎没有第三个(webHttpBidning)端点被暴露。 要重现此问题,请创建WCF应用程序项目,删除Service1服务,添加新项目>名为TestService的WCF服务,并将配置文件更改为以下内容: 以下是ITestService.cs的代码: [ServiceContract] public interface ITestService { [OperationContract] [WebInvoke] Boolean ValidateUser(User user); } [DataContract] public class User { [DataMember(Name = “Name”)] public String UserName { get; set; } [DataMember] public String Password { get; set; } } 并为TestService.svc public class TestService : ITestService { public bool ValidateUser(User user) { if (user.UserName […]

ServiceReferences.ClientConfig中的动态端点

构建应用程序时,它通常部署在不同的环境(test,dev,prod)中,因此端点地址也在不断变化。 由于ServiceReferences.ClientConfig是作为Silverlight的.xap文件的一部分构建的,因此在构建解决方案后很难更改端点,这通常是通过web.config完成的。 我已经搜索了很多,但我不知道这里的最佳做法是什么,所以我的问题是: 在Silverlight中进行动态wcf端点地址配置时,最佳做法是什么? 为了澄清,根据应用程序所在的服务器(test,dev,prod),端点会发生变化: 在某种程度上,我需要silverlight客户端知道使用哪一个,具体取决于它在哪个服务器上/哪个构建编译。