2011-01-25 45 views
1

我在我的應用程序中使用了Windows應用程序和WCF服務。我已經在web服務器上發佈了我的服務,並且我在配置設置中提到了endPointAddress。該應用程序在我的系統和一些系統中正常工作,但無法在另一個系統中登錄。它在登錄時會拋出異常...在C中登錄時發生異常#

在這裏我提到了我的例外情況,可以有人告訴我這個問題的解決方案嗎? 在此先感謝..

例外: 'http://example.com/DashBoardPointsService/Service.svc' 爲目標「

SOAP安全協商http://example.com/DashBoardPointsService/ Service.svc'失敗。有關更多詳情,請參閱內部例外

內部異常:

System.ComponentModel.Win32Exception:安全支持提供程序接口(SSPI)協商失敗。 在System.ServiceModel.Security.WindowsSspiNegotiation.GetOutgoingBlob(字節[] incomingBlob,IExtendedProtectionSupport extendedProtectionSupport) 在System.ServiceModel.Security.SspiNegotiationTokenProvider.GetOutgoingBlobProxy.GetOutgoingBlob(ChannelBinding channelBinding) 在System.ServiceModel.Security.RequestSecurityToken.GetBinaryNegotiation() 在System.ServiceModel.Security.WSTrust.Driver.WriteRequestSecurityToken(RequestSecurityToken RST,的XmlWriter的XmlWriter) 在System.ServiceModel.Security.RequestSecurityToken.WriteTo(XmlWriter的作家) 在System.ServiceModel.Channels.BodyWriter.WriteBodyContents(的XmlDictionaryWriter作家) at System.ServiceModel.Channels.Message.OnWriteMessage(XmlDictionaryWriter writer) at System.Serv系統上的System.ServiceModel.Channels.TextMessageEncoderFactory.TextMessageEncoder.WriteMessage(消息消息,Int32 maxMessageSize,BufferManager bufferManager,Int32 messageOffset) 消息消息(消息消息,BufferManager bufferManager,Int32 initialOffset,Int32 maxSizeQuota)。 ServiceModel.Channels.HttpOutput.SerializeBufferedMessage(消息信息) 在System.ServiceModel.Channels.HttpOutput.Send(時間跨度超時) 在System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.SendRequest(消息消息,時間跨度超時) 在System.ServiceModel.Channels.RequestChannel.Request(消息消息,TimeSpan超時) at System.ServiceModel.Security.IssuanceTokenProviderBase`1.DoNegotiation(TimeSpan timeout)

堆棧跟蹤:

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); 
    } 
} 
+0

你可以發佈WCF服務的配置嗎?什麼是clientCredential類型?客戶端無法連接到的計算機在不同的域中? –

+0

這是我的wcf配置,我在一個函數中使用它。 – Suryakavitha

+0

我看不到它。你有沒有錯過格式化?如果您嘗試使用wsHttpBinding,並且WCF服務或客戶端位於不同的域上,則它將無法工作。改爲使用basicHttpBinding –

回答

0

這可能是配股。

客戶端有一個正在被服務器阻止的安全上下文。

檢查客戶端的身份和服務器上的權限。