2012-08-29 5 views
0

내 로컬 컴퓨터에서 완벽하게 실행되는 Silverlight 응용 프로그램을 사용하며 WCF 서비스를 개발 서버 (Windows 서비스에서 자체 호스팅)에서 사용합니다.Silverlight Windows 서비스에서 자체 호스팅되는 WCF와의 도메인 간 문제

버그의 근본 원인을 찾기 위해 WCF 서비스 중 하나를 디버깅해야합니다. 나는 서비스에 정보를 추적/내 디버그를 추가하고, (심지어 로컬) 가상 머신에 설치되어 있지만 그 이후, 나는 잘 알려진 크로스 도메인 오류 얻을 : 만약 때문에,

"An error occurred while trying to make a request to URI 'http://MyVMMachine:4096/MyService'. This could be due to attempting to access a service in a cross-domain way without a proper cross-domain policy in place, or a policy that is unsuitable for SOAP services. You may need to contact the owner of the service to publish a cross-domain policy file and to ensure it allows SOAP-related HTTP headers to be sent. This error may also be caused by using internal types in the web service proxy without using the InternalsVisibleToAttribute attribute. Please see the inner exception for more details."

이상하다 dev에 서버에서 소모, 괜찮아요,하지만 dev에 컴퓨터에 서비스를 설치하는 경우 또는 심지어 로컬 (자체 서비스뿐만 아니라 Windows 서비스에서 호스팅), 작동하지 않습니다. 여기

가 서비스 원래 코드 :

public partial class WindowsService : ServiceBase 
{ 
    ServiceHost _Host; 

    public WindowsService() 
    { 
     try 
     { 
      InitializeComponent(); 
     } 
     catch (Exception exc) 
     { 
      Server.One.Log("Windows service initialization failed: " + exc.Message); 
     } 
    } 

    protected override void OnStart(string[] args) 
    { 
     try 
     { 
      Server.One.Start(); 
      _Host = new ServiceHost(typeof(Service)); 
      _Host.Open(); 
     } 
     catch (Exception exc) 
     { 
      Server.One.Log("Windows service start failed: " + exc.Message); 
     } 
    } 

    protected override void OnStop() 
    { 
     try 
     { 
      if (_Host != null) 
       _Host.Close(); 
      Server.One.Stop(); 
     } 
     catch (Exception exc) 
     { 
      Server.One.Log("Windows service stop failed: " + exc.Message); 
     } 
    } 
} 

이 주제에 Carlos Figueira's article을 읽은 후, 나는 그의 접근 방식을 적용하는 서비스를 변경,하지만 여전히 작동하지 않습니다.

어떤 아이디어 ???

감사합니다.

답변

0

귀하의 신청서가 실제로 귀하의 서비스를 요구하는 곳을 찾으려면 피들러를 사용해보십시오.

그냥 서버 포트에 ServiceReferences.ClientConfig 변경)

이 나에게 몇 번 일어난 그것은 일반적으로 인해 서버 포트이었다 8을 변경합니다.

은 서비스 프로젝트 구성 (웹 탭)에서 봐, 그리고 당신이 그것을 호출 할 경우 4096로 특정 포트를 설정합니다

enter image description here

+0

이봐. 나는 벌써했다 (나는 그것을 게시해야했다). 앱에서 두 파일을 모두 요청하고 있습니다. clientaccesspolicy.xml W crossdomain.xml 파일에 대해 400 결과. 나는 양쪽 다 가지고있다. 그러나 이것이 자기 주최의 것이기 때문에 나는 그것을 얻을 수 있다고 생각하지 않는다. – Roberto

+0

도움 주셔서 감사합니다. clientconfig를 이미 올바른 서버/포트로 변경했습니다. 웹 탭에 대해서,이 서비스는 윈도우 서비스이기 때문에 나는 서비스 측면에서 서비스를 제공하지 않을 것이라고 생각합니다. – Roberto

+0

아야, 웹 프로젝트 xD가 아니란 걸 깨닫지 못했습니다 xD – zapico