C# 在C中登录时发生异常#
我正在我的应用程序中使用windows应用程序和WCF服务。我已经在web服务器中发布了我的服务,并且在配置设置中引用了该endPointAddress。该应用程序在我的系统和某些系统中正常工作,但无法在其他系统中登录。它在登录时抛出一个异常 在这里我提到了我的例外,有谁能告诉我这个问题的解决方法吗? 提前谢谢 例外情况: 与'http://example.com/DashBoardPointsService/Service.svc“针对目标”http://example.com/DashBoardPointsService/Service.svc"失败了。有关详细信息,请参阅内部异常 内部异常: System.ComponentModel.Win32异常:安全支持提供程序接口(SSPI)协商失败。 位于System.ServiceModel.Security.WindowsSSPineGotation.GetOutgoingBlob(字节[]incomingBlob,IExtendedProtectionSupport extendedProtectionSupport) 位于System.ServiceModel.Security.SspiNegotiationTokenProvider.GetOutgoingBlobProxy.GetOutgoingBlob(ChannelBinding ChannelBinding) 位于System.ServiceModel.Security.RequestSecurityToken.GetBinaryNegotiation()处 位于System.ServiceModel.Security.WSTrust.Driver.WriterRequestSecurityToken(RequestSecurityToken rst,XmlWriter XmlWriter) 位于System.ServiceModel.Security.RequestSecurityToken.WriteTo(XmlWriter) 位于System.ServiceModel.Channel.BodyWriter.WriteByContents(XmlDictionaryWriter编写器) 位于System.ServiceModel.Channel.Message.OnWriteMessage(XmlDictionaryWriter编写器) 位于System.ServiceModel.Channels.BufferedMessageWriter.WriteMessage(消息消息,BufferManager BufferManager,Int32 initialOffset,Int32 maxSizeQuota) 位于System.ServiceModel.Channels.TextMessageEncoderFactory.TextMessageEncoder.WriteMessage(消息消息,Int32 maxMessageSize,BufferManager BufferManager,Int32 messageOffset) 在System.ServiceModel.Channels.HttpOutput.SerializedBufferedMessage(消息消息)处 位于System.ServiceModel.Channels.HttpOutput.Send(TimeSpan超时) 位于System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.SendRequest(消息消息,TimeSpan超时) 位于System.ServiceModel.Channels.RequestChannel.Request(消息消息,TimeSpan超时) 位于System.ServiceModel.Security.IssuanceTokenProviderBase`1.Donegationation(TimeSpan超时) 堆栈跟踪:C# 在C中登录时发生异常#,c#,.net,wcf,exception-handling,C#,.net,Wcf,Exception Handling,我正在我的应用程序中使用windows应用程序和WCF服务。我已经在web服务器中发布了我的服务,并且在配置设置中引用了该endPointAddress。该应用程序在我的系统和某些系统中正常工作,但无法在其他系统中登录。它在登录时抛出一个异常 在这里我提到了我的例外,有谁能告诉我这个问题的解决方法吗? 提前谢谢 例外情况: 与'http://example.com/DashBoardPointsService/Service.svc“针对目标”http://example.com/DashBoa
at System.ServiceModel.Security.IssuanceTokenProviderBase`1.DoNegotiation(TimeSpan timeout)
at System.ServiceModel.Security.SspiNegotiationTokenProvider.OnOpen(TimeSpan timeout)
at System.ServiceModel.Security.WrapperSecurityCommunicationObject.OnOpen(TimeSpan timeout)
at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
at System.ServiceModel.Security.SecurityUtils.OpenCommunicationObject(ICommunicationObject obj, TimeSpan timeout)
at System.ServiceModel.Security.SymmetricSecurityProtocol.OnOpen(TimeSpan timeout)
at System.ServiceModel.Security.WrapperSecurityCommunicationObject.OnOpen(TimeSpan timeout)
at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
at System.ServiceModel.Channels.SecurityChannelFactory`1.ClientSecurityChannel`1.OnOpen(TimeSpan timeout)
at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
at System.ServiceModel.Security.SecuritySessionSecurityTokenProvider.DoOperation(SecuritySessionOperation operation, EndpointAddress target, Uri via, SecurityToken currentToken, TimeSpan timeout)
at System.ServiceModel.Security.SecuritySessionSecurityTokenProvider.GetTokenCore(TimeSpan timeout)
at System.IdentityModel.Selectors.SecurityTokenProvider.GetToken(TimeSpan timeout)
at System.ServiceModel.Security.SecuritySessionClientSettings`1.ClientSecuritySessionChannel.OnOpen(TimeSpan timeout)
at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannel.OnOpen(TimeSpan timeout)
at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannel.CallOnceManager.CallOnce(TimeSpan timeout, CallOnceManager cascade)
at System.ServiceModel.Channels.ServiceChannel.EnsureOpened(TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)
Exception rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
at IService.GetLoginDetails(String strUserName, String strPassword)
at ExportReportsandPointsDetails.frmLogin.btnSubmit_Click(Object sender, EventArgs e)
资料来源:
这是我的WCF服务配置设置:
public void CreateConnection()
{
try
{
string strNewURL = "http://example.com/DashBoardPointsService/Service.svc";
EndpointAddress ep = new EndpointAddress(strNewURL);
WSHttpBinding binding = new WSHttpBinding();
binding.Security.Mode = SecurityMode.Message;
binding.MaxBufferPoolSize = 819222;
binding.MaxReceivedMessageSize = 819222;
binding.ReceiveTimeout = TimeSpan.MaxValue;
binding.SendTimeout = TimeSpan.MaxValue;
binding.OpenTimeout = TimeSpan.MaxValue;
binding.CloseTimeout = TimeSpan.MaxValue;
binding.MaxReceivedMessageSize = 99999999;
binding.MaxBufferPoolSize = 99999999;
binding.ReaderQuotas.MaxArrayLength = 714748;
binding.ReaderQuotas.MaxBytesPerRead = 214748;
binding.ReaderQuotas.MaxDepth = 2147483647;
binding.ReaderQuotas.MaxNameTableCharCount = 214749;
binding.ReaderQuotas.MaxStringContentLength = 214749;
objConnectionManager = new ChannelFactory<IService>(binding, ep);
objActivatedConnectionManager = objConnectionManager.CreateChannel();
}
catch (Exception ex)
{
objlog.Write(ex);
}
}
public void CreateConnection()
{
尝试
{
字符串strNewURL=”http://example.com/DashBoardPointsService/Service.svc";
EndpointAddress ep=新的EndpointAddress(strNewURL);
WSHttpBinding=新的WSHttpBinding();
binding.Security.Mode=SecurityMode.Message;
binding.MaxBufferPoolSize=819222;
binding.MaxReceivedMessageSize=819222;
binding.ReceiveTimeout=TimeSpan.MaxValue;
binding.SendTimeout=TimeSpan.MaxValue;
binding.OpenTimeout=TimeSpan.MaxValue;
binding.CloseTimeout=TimeSpan.MaxValue;
binding.MaxReceivedMessageSize=9999999;
binding.MaxBufferPoolSize=9999999;
binding.ReaderQuotas.MaxArrayLength=714748;
binding.ReaderQuotas.MaxBytesPerRead=214748;
binding.ReaderQuotas.MaxDepth=2147483647;
binding.ReaderQuotas.MaxNameTableCharCount=214749;
binding.ReaderQuotas.MaxStringContentLength=214749;
objConnectionManager=新通道工厂(绑定,ep);
objActivatedConnectionManager=objConnectionManager.CreateChannel();
}
捕获(例外情况除外)
{
objlog.Write(ex);
}
}
这可能是一个权利问题
客户端具有被服务器阻止的安全上下文
检查客户端的身份和服务器上的权限。您可以发布WCF服务的配置吗?什么是clientCredential类型?客户端未能连接到的计算机是否在其他域中?这是我的wcf配置,我在函数中使用了它。我没有看到它。你错过格式化了吗?如果您试图使用wsHttpBinding,并且WCF服务或客户端位于不同的域上,那么它将无法工作。请改用basicHttpBinding