2011-10-19 3 views
8

이 문제는 Google 서비스에 액세스하는 모든 클라이언트에서 발생하지 않지만 일관성있는 것은 오류가 발생했을 때 소수의 고객을위한 동일한 서비스 요청.받기 403 금지 된 오류. 클라이언트 인증 스키마 '익명'으로 HTTP 요청이 금지되었습니다.

System.ServiceModel.Security.MessageSecurityException The HTTP request was forbidden with client authentication scheme 'Anonymous'. System.ServiceModel.Security.MessageSecurityException: The HTTP request was forbidden with client authentication scheme 'Anonymous'. > ---> System.Net.WebException: The remote server returned an error: (403) Forbidden. at System.Net.HttpWebRequest.GetResponse() at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout) --- End of inner exception stack trace --- Server stack trace: at System.ServiceModel.Security.IssuanceTokenProviderBase 1.DoNegotiation(TimeSpan timeout) at System.ServiceModel.Security.SspiNegotiationTokenProvider.OnOpen(TimeSpan timeout) at System.ServiceModel.Security.TlsnegoTokenProvider.OnOpen(TimeSpan timeout) at System.ServiceModel.Security.WrapperSecurityCommunicationObject.OnOpen(TimeSpan timeout) at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout) at System.ServiceModel.Security.CommunicationObjectSecurityTokenProvider.Open(TimeSpan timeout) at System.ServiceModel.Security.SecurityUtils.OpenTokenProviderIfRequired(SecurityTokenProvider tokenProvider, 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.CallOpenOnce.System.ServiceModel.Channels.ServiceChannel.ICallOnce.Call(ServiceChannel channel, 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.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs) 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 > Proxy.FileTransferService.IFileTransferService.EstablishProxy(DownloadRequest request) at Proxy.FileTransferService.FileTransferServiceClient. Proxy.FileTransferService.IFileTransferService.EstablishProxy(DownloadRequest request) at NormalFileTransferServiceClient.Download(Int32 packageId, IStreamWriter downloader, Archiver archiver) at LoggingFileTransferServiceClient.Download(Int32 packageId, ISt

그 예외가 클라이언트에 의해 발생되고 : 여기

예외의 세부 사항입니다. (내가 제대로 모든 것을 설정 한 경우) 몇 클라이언트는은 BasicHttpBinding을 사용하고 있습니다 :

<binding name="WSHttpBinding_IFileTransferService" closeTimeout="00:01:00" 
    openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" 
    bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard" 
    maxBufferPoolSize="524288" maxReceivedMessageSize="65536" messageEncoding="Mtom" 
    textEncoding="utf-8" useDefaultWebProxy="true" allowCookies="false"> 
    <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" 
    maxBytesPerRead="4096" maxNameTableCharCount="16384" /> 
    <reliableSession ordered="true" inactivityTimeout="00:10:00" 
    enabled="false" /> 
    <security mode="Message"> 
    <transport clientCredentialType="Windows" proxyCredentialType="None" 
     realm="" /> 
    <message clientCredentialType="UserName" negotiateServiceCredential="true" 
     algorithmSuite="Default" establishSecurityContext="true" /> 
    </security> 
</binding> 

    <endpoint address="http://[hostname]/FileTransferService.svc/FileTransfer" 
    binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IFileTransferService" 
    contract="Proxy.FileTransferService.IFileTransferService" 
    name="WSHttpBinding_IFileTransferService"> 
    <identity> 
     <certificate encodedValue="a long string"/> 
    </identity> 
    </endpoint> 

서비스 구성은

<service behaviorConfiguration="ServiceBehavior" 
    name="Services.FileTransferService"> 
     <endpoint name="WSHttpBinding_IFileTransferService" 
     binding="wsHttpBinding" 
     bindingConfiguration="MtomWSHttpBinding" 
     contract="Services.IFileTransferService" 
     address="/FileTransfer"/> 
     <endpoint binding="basicHttpBinding" 
     bindingConfiguration="FileTransferServicesBinding" 
     contract="Services.IFileTransferService"/> 
     <host> 
      <baseAddresses> 
      <add baseAddress="http://[hostname]/FileTransferService.svc"/> 
      </baseAddresses> 
     </host> 
</service> 

<binding name="wsHttpBinding" 
     maxReceivedMessageSize="2147483647" 
     receiveTimeout="5" 
     useDefaultWebProxy="false"> 
     <readerQuotas maxDepth="2147483647" 
      maxStringContentLength="2147483647" 
      maxArrayLength="2147483647" 
      maxBytesPerRead="2147483647" 
      maxNameTableCharCount="2147483647" /> 
    <security mode="Message"> 
    <message clientCredentialType="UserName" /> 
    </security> 
</binding> 

<basicHttpBinding> 
    <binding name="FileTransferServicesBinding" 
      maxReceivedMessageSize="10067108864" 
      messageEncoding="Mtom" 
      transferMode="Streamed" 
      useDefaultWebProxy="false"> 
     <security mode="None"> 
     <message clientCredentialType="UserName" /> 
     </security> 
    </binding> 
    </basicHttpBinding> 

주 :

IFileTransferService의 클라이언트 프록시 구성이다. 클라이언트의 최신 릴리스에서는 완전히 분산되지 않았을 수 있습니다 (2 버전을 지원해야하는 이유). 대신 wsHttpBinding 끝점을 사용하도록 프록시를 변경했습니다. 나는이 오류가 내가 basicHttp에만 해당되는지 궁금 하네. 만약 그렇다면 어쩌면이 설정이 올바르게 설정되어 있지 않은지 궁금 할 것이다. 나는이 403 오류를 얻는 클라이언트가 wsHttpBinding을 사용한다는 가정하에 있습니다. 여기

이 서비스에 대한 코드입니다 : 뭔가 withing에 내 컨트롤이이 예외를 치우는 경우

public RemoteBinaryInfo EstablishProxy(DownloadRequest request) 
{ 
    int packageId = request.PackageId; 

    System.IO.MemoryStream stream = new System.IO.MemoryStream(packageRepository.GetPackageBinary(packageId)); 

    DisposeStreamWhenOperationIsComplete(stream, OperationContext.Current); 

    RemoteBinaryInfo result = new RemoteBinaryInfo(); 
    result.Length = stream.Length; 
    result.MemoryByteStream = stream; 
    return result; 

} 

private static void DisposeStreamWhenOperationIsComplete(System.IO.MemoryStream stream, OperationContext clientContext) 
{ 
    clientContext.OperationCompleted += new EventHandler(delegate(object sender, EventArgs args) 
    { 
     if (stream != null) 
      stream.Dispose(); 
    }); 
} 

가 하나라도 알고 있나요입니까? 클라이언트 또는 서비스 구성 파일에서 구성을 변경할 수 있습니까?

더 이상 정보가 필요하면 알려주십시오.

+0

아직 완료되지 않은 경우 간단한 hello world 메서드를 노출하여 문제를 격리해야합니다. – JoeBilly

답변

0

MessageSecurityException을 수신하는 클라이언트가 요청에 유효한 사용자 이름/암호를 제공하지 않는 것처럼 들리는군요.

은 그래서 당신은 익명 인증을 사용하여 IIS에서 구성된 웹 서비스를 다음 MSDN 주제 http://msdn.microsoft.com/en-us/library/ms733131.aspx

+0

위의 작업을 수행중인 경우 오류를 수신하는 클라이언트와 그들이 호출하는 도메인 사이에 연결이 있습니까? 오류를 수신하는 클라이언트가 프록시를 통해 요청을 보내지 않는다는 것을 배제하는 것도 유용 할 것입니다. 도움이되지 않으면 클라이언트와 서비스 모두에서 메시지 추적을 사용하십시오. http://msdn.microsoft.com/en-us/library/ms730064.aspx –

+0

사용자 이름과 암호는 다음 코드에서 직접 제공됩니다. 해독됩니다. 클라이언트와 이러한 서비스간에 사람과의 상호 작용은 없습니다. 생성 한 프록시는 애플리케이션과 함께 배포되고 자동으로 실행됩니다. – SideFX

+0

나는 이미이 creds.ServiceCertificate.Authentication.CertificateValidationMode = X509CertificateValidationMode.PeerTrust; 하지만 문제가 해결 될 수 있습니다. creds.ServiceCertificate.Authentication.TrustedStoreLocation = StoreLocation.LocalMachine; 내가 얻는 오류는 모든 클라이언트 요청에 대해서는 발생하지 않지만 어쩌면 특정 클라이언트 네트워크 구성이 위의 코드를 추가해야 할 수도 있습니다. 명시 적으로 클라이언트에서 서버 인증서의 위치를 ​​명시하는 목적은 무엇입니까? – SideFX

0

를 참조하십시오, 당신은 사용자의 소수에 대한 403 금지 오류가 발생합니다.

내 경험에 비추어 볼 때 이는 일반적으로 파일 시스템과 같은 ACL 제어 시스템 리소스에 액세스 할 때 액세스 거부 예외로 인해 발생합니다.

일반적으로 응용 프로그램 풀 ID (IIS APPPOOL/AppPoolName)가있는 w3wp.exe 프로세스에 의해 비정상적으로 연결된 모든 사용자가 요청을 처리합니다 (IIS 7 가정). 해당 ID가 필요한 액세스 제어 목록에 추가되지 않은 경우 액세스가 거부 된 예외로 인해 IIS가 403 오류로 응답합니다.

일반적으로 응용 프로그램 풀 ID를 그룹에 추가 한 다음 그룹을 필요한 모든 리소스에 추가합니다.

예외를 유발할 수있는 리소스를 파악할 수없는 경우 보안 이벤트 로그에서 단서의 "감사 실패"항목을 찾아보십시오. 보안 이벤트를 로깅하도록 로컬 보안 정책을 구성해야 할 수 있습니다.이 오류는 우리 조직의 HTTP 프록시 서버에서였다 내 경우

3

행운을 빕니다. MessageSecurityException.InnerException.Response.Headers :

{마임 버전 : 1.0
X-오징어-오류 : ERR_ACCESS_DENIED 0
X-캐시 : <
X-캐시 조회에서 MISS : NONE < 프록시 -에서에서 발견 서버 주소>
프록시 연결 : 가까운
콘텐츠 길이 : 2165
의 Content-Type : text/html과
날짜 : 2012년 4월 25일 (수) 그리니치 표준시 10시 55분 39초
01 23,516,서버 : 오징어/3.0.STABLE25
통해 1.0 < 프록시 서버 주소> (오징어/3.0.STABLE25) 내 경우

은 또한 파일 전송 방법에 대한 발생
은} 파일을 전송하는 크기가 16384 인 byte 배열에 청크가 있습니다. 크기를 10000으로 줄이면 오류가 해결되었습니다. 즉, 프록시 서버에는 크기 제한이 설정되어 있습니다. 직접 인터넷 접속을 갖는 시스템에서

는 파일 전송 방법은도 배열 크기의 경우,이 오류로 인해 실패하지> 16384

고객 중 일부는이 문제에 직면하는 경우에만 때문에, 아마도 그들은 방화벽 뒤에/프록시 서버가 실제로 액세스를 차단하고이 오류를 반환합니까?

+0

여기에 있습니다. Bypass 프록시 서버에서 로컬 주소를 확인하지 않았습니다. – AlexDev

관련 문제