我担心文件应该包含在.NET项目的部署中.我有使用WCF服务的控制台应用程序.WCF服务正在HTTP上运行.我是否需要部署Service References文件夹中的所有XSD,SVCINFO,WSDL和SVCMAP文件?
谢谢你的帮助.我确定希望Microsoft有一个页面明确解释了部署中需要哪些文件类型.
我的webservice中有一个类作为DataContract,它继承自IEquatable.但我的siverlight webservice生成的代理类没有equals.任何人都可以告诉我为什么会这样,有没有办法实现这一目标?
我是WCF的新手,所以请说明你是否发现了我在这里完全错误的事情.我创建了一个WCF服务项目(我的服务类是从ServiceBase类中提取的),端点地址绑定设置为basicHttpBinding.现在我需要创建一个可以从此服务调用某些API的客户端应用程序.我的问题是,在我的客户端应用程序中,如何添加对该服务的服务引用.我是否需要首先在IIS下发布此服务(这意味着我也必须在计算机上使用IIS),或者是否还有其他一些添加服务引用的方法.
我在另一台机器上部署了WCF服务,我想根据WCF服务对客户端进行身份验证.
我做了以下事情:
1)在IIS中,我取消选中匿名访问并选中"集成Windows身份验证"复选框.
2)我的Web配置
<authentication mode="Windows" />
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBind">
<security mode="TransportCredentialOnly">
<transport clientCredentialType="Ntlm" proxyCredentialType="Ntlm" />
</security>
</binding>
</basicHttpBinding>
</bindings>
Run Code Online (Sandbox Code Playgroud)
3)在客户端,我传递的用户凭证如下:
MyServiceClient _client;
_client = new MyServiceClient();
_client.ClientCredentials.Windows.ClientCredential.UserName = "username";
_client.ClientCredentials.Windows.ClientCredential.Password = "password";
_client.ClientCredentials.Windows.ClientCredential.Domain = "mydomain";
Run Code Online (Sandbox Code Playgroud)
我的问题是如何在服务器端(部署服务的位置)捕获用户名和密码?
如何根据传递的凭据对用户进行身份验证?
目前我正在使用basichttp绑定..这种绑定是否足以支持安全模型?
我必须使用SOAP使用第三方Web服务.很容易让它与WCF一起工作,但现在我遇到了SOAP故障的问题.该服务发送给我一个不正确的SOAP错误:
<?xml version="1.0" encoding="utf-8" ?>
<SOAP-ENV:Envelope
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Body>
<SOAP-ENV:Fault>
<SOAP-ENV:faultcode>14</SOAP-ENV:faultcode>
<SOAP-ENV:faultstring>Unknown Function</SOAP-ENV:faultstring>
</SOAP-ENV:Fault>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
Run Code Online (Sandbox Code Playgroud)
错误是<faultcode>必须没有命名空间:
System.ServiceModel.CommunicationException : Server returned an invalid
SOAP Fault. Please see InnerException for more details.
----> System.Xml.XmlException : Start element 'faultcode' from namespace
'' expected. Found element 'SOAP-ENV:faultcode' from namespace
'http://schemas.xmlsoap.org/soap/envelope/'.
Run Code Online (Sandbox Code Playgroud)
我无法更改原始的Web服务 - 但是WCF中是否有任何东西可以用来以某种方式处理这些错误消息而无需一直处理CommunicationException?
可能遗漏了一些非常基本的东西.我创建了一个WCF 4.0 Rest服务.当我从浏览器访问网址时,它没有问题,我正在回复我想要的东西.
但是现在我想从客户端mvc应用程序中使用该服务(它也将被其他非.net平台使用,这就是为什么它首先是一个休息服务).
问题是如何获得服务引用,以便我可以开始在我的c#代码中使用它?使用新的最小WCF .net 4配置方法并且没有服务契约的接口,我不知道如何指定mex端点.最终,我不想在生产过程中使用mex端点,只是在开发过程中.我希望能够指定我的所有服务(在一个应用程序中大约10个)都有一个端点和一个小的配置,vs2010 .config转换只是在我发布时撕掉了.
我在通过此处的方法" 集中式cookie管理 "中概述的方法进行WCF服务调用时管理共享的auth cookie :http://megakemp.com/2009/02/06/managing-shared-cookies-in- WCF /
我已经建立了一个自定义的IClientMessageInspector,IEndpointBehavior,BehaviorExtensionElement,的作品.我的端点行为添加了一个消息检查器,如下所示:
public class MyEndpointBehavior : IEndpointBehavior
{
public void AddBindingParameters(ServiceEndpoint endpoint, System.ServiceModel.Channels.BindingParameterCollection bindingParameters)
{
}
public void ApplyClientBehavior(ServiceEndpoint endpoint, System.ServiceModel.Dispatcher.ClientRuntime clientRuntime)
{
// yuck.. Wish I had an instance of MyClientMessageInspector
// (which has the auth cookie already) so I could just inject that
// instance here instead of creating a new instance
clientRuntime.MessageInspectors.Add(new MyClientMessageInspector());
}
public void ApplyDispatchBehavior(ServiceEndpoint endpoint, System.ServiceModel.Dispatcher.EndpointDispatcher endpointDispatcher)
{
} …Run Code Online (Sandbox Code Playgroud) structuremap wcf dependency-injection wcf-client endpointbehavior
我有一个奇怪的问题,我的客户端在从我的WCF服务调用方法时会挂起.现在真正奇怪的是,当客户端是控制台应用程序时,这不会发生.当客户端是WinForm或WPF应用程序时,它确实发生.
我创建了一个客户端库,WCF客户端可以使用它连接到服务,如下所示:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ServiceModel; //needed for WCF communication
namespace DCC_Client
{
public class DCCClient
{
private DuplexChannelFactory<ServiceReference1.IDCCService> dualFactory;
public ServiceReference1.IDCCService Proxy;
public DCCClient()
{
//Setup the duplex channel to the service...
NetNamedPipeBinding binding = new NetNamedPipeBinding();
dualFactory = new DuplexChannelFactory<ServiceReference1.IDCCService>(new Callbacks(), binding, new EndpointAddress("net.pipe://localhost/DCCService"));
}
public void Open()
{
Proxy = dualFactory.CreateChannel();
}
public void Close()
{
dualFactory.Close();
}
}
public class Callbacks : ServiceReference1.IDCCServiceCallback
{
void ServiceReference1.IDCCServiceCallback.OnCallback(string id, string message, Guid …Run Code Online (Sandbox Code Playgroud) 我正在构建WCF服务,我想接受List作为我的方法之一的参数.
这是我的代码:
[ServiceContract]
public interface IProductService
{
[OperationContract]
int InsertProducts(List<Product> products);
}
[DataContract]
[KnownType(typeof(List<Product>))]
public class Product
{
[DataMember]
public int ProductId{ get; set; }
[DataMember]
public string ProductName{ get; set; }
[DataMember]
public List<Product> Products { get; set; }
}
Run Code Online (Sandbox Code Playgroud)
当我运行服务时,它给了我一个错误.
WCF不支持此操作,因为它使用 NameSpace.Product[]
我们有一个需要大量数据的wcf服务.作为一项要求,我们希望将请求对象gzip压缩并使用相同的压缩来响应它们.我怎样才能做到这一点?我找不到任何描述此问题的文件.
我如何开发一个像这样工作的wcf soap服务以及如何使用这种服务?
wcf-client ×10
wcf ×9
c# ×3
asp.net-4.0 ×1
compression ×1
datacontract ×1
gzip ×1
soap ×1
structuremap ×1
wcf-rest ×1
wcf-security ×1