Tag: #wcf

未提供所需的模拟级别,或者提供的模拟级别无效

我在使用WCF服务和模拟时遇到了一些问题,我已将其提炼为下面的简单方法。 WCF服务目前在exe中自托管。 exception消息是“未提供所需的模拟级别,或者提供的模拟级别无效”。 检查错误何时抛出,Identity ImpersonationLevel设置为委托,如我的客户端上指定的,并通过Kerberos进行身份validation。 我有点困惑,因为在我看来ImpersonationLevel和Authenticaiton的要求已经得到满足。 我的想法是问题可能与域设置有关,我已经设置并认为设置正确。 所以我有两个问题: 下面的操作应该成功吗? (或者它有缺陷吗?) 需要在Win2k8域上配置哪些设置才能使其正常工作? 我正在使用两个属于同一个Win2k8域的成员(它是一个新域和非常香草,旨在测试模拟)。 代码如下: [OperationBehavior(Impersonation = ImpersonationOption.Required)] public string Test() { WindowsIdentity identity = ServiceSecurityContext.Current.WindowsIdentity; using (identity.Impersonate()) { ProcessStartInfo pi = new ProcessStartInfo(@”c:\temp\test.bat”); pi.UseShellExecute = false; pi.RedirectStandardOutput = true; Process p = Process.Start(pi); // exception thrown here! p.WaitForExit(); string o = p.StandardOutput.ReadToEnd(); return o; } } […]

WCF多个绑定

当我尝试多个终点时,我收到以下错误.. System.ServiceModel.AddressAlreadyInUseException: The TransportManager failed to listen on the supplied URI using the NetTcpPortSharing service: the service failed to listen. at System.ServiceModel.Channels.SharedConnectionListener.SharedListenerProxy.Register() at System.ServiceModel.Channels.SharedConnectionListener.SharedListenerProxy.Open(Boolean isReconnecting) at System.ServiceModel.Channels.SharedConnectionListener.StartListen(Boolean isReconnecting) at System.ServiceModel.Channels.SharedConnectionListener..ctor(BaseUriWithWildcard baseAddress, Int32 queueId, Guid token, OnDuplicatedViaDelegate onDuplicatedViaCallback) at System.ServiceModel.Channels.SharedTcpTransportManager.OnOpenInternal(Int32 queueId, Guid token) at System.ServiceModel.Channels.SharedTcpTransportManager.OnOpen() at System.ServiceModel.Channels.TransportManager.Open(TransportChannelListener channelListener) at System.ServiceModel.Channels.TransportManagerContainer.Open(SelectTransportManagersCallback selectTransportManagerCallback) at System.ServiceModel.Channels.TransportChannelListener.OnOpen(TimeSpan timeout) at System.ServiceModel.Channels.ConnectionOrientedTransportChannelListener.OnOpen(TimeSpan […]

当WCF服务运行批处理文件时,XCopy或MOVE不起作用。 为什么?

我遇到过这样一种情况,即同一批处理文件与命令行的工作方式不同,以及何时从IIS上托管的WCF服务触发。 区别在于XCOPY命令。 当我正常运行批处理文件时,XCOPY会移动我需要的所有数据 XCOPY “C:\from” “C:\to” /K /R /E /I /S /C /H /G /X /Y 但是当它从WCF服务运行时,不会复制任何内容。 从我的服务运行批处理我使用以下代码在C#中执行批处理文件稍作修改。 我的应用程序拉动在LocalSystem帐户下运行。 我还尝试使用自己的帐户进行应用程序调查 – 不起作用。 怎么了? 简短更新:我最近学到的是我的WCF服务在App Pool User下运行,但过程不是。 为了实验,我在流程开始代码中进行了更新 var pwdArray = “mypassword”.ToArray(); var pwd = new System.Security.SecureString(); Array.ForEach(pwdArray, pwd.AppendChar); processInfo.UserName = “myuser”; processInfo.Password = pwd; processInfo.Domain = “LocalMachine”; 但它没有帮助。 似乎在描述的条件下运行XCOPY是神秘的。 还有一个更新:在常规Windows服务下启动的进程中也发现了与XCopy相同的问题。

标记WCF合同中已弃用的字段

我有一个与客户端v1一起使用的wcf合同。 现在我正在研究服务v2,我想将某些字段标记为已弃用,因此客户端v1将查看并使用它们,而客户端v2将忽略它们。 这个问题有什么最佳做法吗? 我应该使用WCF中的任何现有属性吗? 谢谢。

WCF服务的启动方法在哪里?

我需要在第一次调用wcf服务之前运行一些方法,我在哪里放这些方法? WCF服务的启动方法在哪里? Obs1:我的WCF服务将在IIS6上运行。 Obs2:我正在使用.net framework 4.0。

wcf配置文件vs代码配置的优点和缺点

我有一个自托管的C#WCF服务,可以为各种目的创建20多个端点。 每个都在代码本身配置,在服务的app.config中有一些基本配置项,如端口和地址。 该服务非常适合经过测试的客户,但尚未经过广泛测试。 我对标准的wcf配置文件方法有点小心,因为我担心最终用户会搞砸事情,因此在代码中做了所有事情。 在配置文件中进行配置是一个更好的主意,因为最终用户可以根据自己的需要对其进行自定义,还是满足大多数需求的代码方法?

请求已中止:无法创建SSL / TLS安全通道 – Decrypt已返回SEC_I_RENEGOTIATE

我们的应用程序使用C#(.Net framework 3.5)中的Web服务。 大多数时候从服务器获得正确的响应,但它间歇性地抛出错误: The request was aborted: Could not create SSL/TLS secure channel. 启用它显示的跟踪: System.Net Error: 0 : [3688] Decrypt returned SEC_I_RENEGOTIATE. 以前有人遇到过这个问题吗? 这个问题的解决方法是什么? 请告诉我。 任何帮助将受到高度赞赏。 提前致谢! -Jemo

WCF服务默认值

我有我的WCF服务的以下数据合同类: [DataContract(Name = “MyClassDTO”)] public class MyClass { private string name = “Default Name”; [DataMember] public string Name { get { return name; } set { name = value; } } } 当我使用Visual Studio的添加服务引用函数生成WCF服务引用时,生成的DataContract看起来像这样: [System.Diagnostics.DebuggerStepThroughAttribute()] [System.CodeDom.Compiler.GeneratedCodeAttribute(“System.Runtime.Serialization”, “3.0.0.0”)] [System.Runtime.Serialization.DataContractAttribute(Name = “MyClassDTO”, Namespace = “xxx”)] [System.SerializableAttribute()] public partial class MyClassDTO : object, System.Runtime.Serialization.IExtensibleDataObject, System.ComponentModel.INotifyPropertyChanged { [System.Runtime.Serialization.OptionalFieldAttribute()] private […]

WCF身份validation – validation邮件的安全性时发生错误

我在使用clientCredentialType=”UserName”连接到我的WCF服务时遇到问题。 当我运行下面的代码时,我收到一个错误 FaultException:validation消息的安全性时发生错误。 当玩一些绑定值时,我也得到Access is denied. 。 Fiddler说没有授权标题,我也无法在请求中找到用户名或密码。 以下是我配置的摘录: 我的用户名/密码validation器如下所示: public class UserAuthentication : UserNamePasswordValidator { public override void Validate(string userName, string password) { EntitiesContext db = new EntitiesContext(); db.Logs.Add(new DomainModels.Log() { DateLogged = DateTime.Now, Message = “hit auth”, Type = DomainModels.LogType.Info }); db.SaveChanges(); try { if (userName == “test” && password == “test123”) { […]

如何从工作线程中调用UI线程上的方法?

我正在开发一个使用以下技术的项目: C#(.NET 4.0) WCF 棱镜4 我目前正在使用代理生成的Begin / End方法对我们的一个Web服务进行异步调用。 调用成功,客户端能够在工作线程上接收Web服务的响应。 收到回复后,我继续举办活动。 订阅该事件的类继续使用PRISM请求UI导航: Application.Current.Dispatcher.BeginInvoke(new Action(() => this.RegionManager.RequestNavigate(RegionNames.LoginContentRegion, projectSelectionViewUri))); 由于未在UI线程上捕获异步WCF响应,因此我不得不使用Application.Current.Dispatcher.BeginInvoke(…)调用UI线程。 这里的问题是调用似乎什么都不做。 UI未更新,并且不会引发exception。 我应该如何从工作线程中引发的事件中调用UI线程? 编辑:此问题已在以下链接中重新询问,因为假设的副本未提供答案: 在异步WCF响应线程上使用PRISM 4请求UI导航