Silverlight 코드에서 WCF 기능을 실행하려고했습니다. WCF가 사이트 www.my-site.com에서 실행 중입니다. Silverlight 응용 프로그램은 사이트 www.vkontakte.ru에서 다운로드 한 < IFrame /> HTML 페이지의 일부로 www.my-site.com 사이트에서 다운로드 할 수 있습니다. : ActionNotSupported 오류가 발생했습니다.
무엇이 잘못 되었나요? http://www.my-site.com/MyService.svc HTTP/1.1
동의Crossdomain WCF - Silverlight 구성 오류 a : ActionNotSupported
POST : /
리퍼러 : 여기
나의 실버 라이트 응용 프로그램에서 요청을 보냈습니다되는 http://www.my-site.com/ClientBin/MySlApp.xap
수락 - 언어 : RU-RU
콘텐츠 길이 : 153
콘텐츠 유형 : text/xml; 문자셋 = UTF-8
이 SOAPAction : "http://tempuri.org/IMyService/Add"
인코딩 수락 :, GZIP을
사용자 에이전트 수축 : 모질라/5.0 (호환; MSIE 9.0; 윈도우 NT 6.1; 트라이던트/5.0)
호스트 : www.my-site.com
연결 : 보관하십시오 - 살아
에서 Pragma을 : 더 캐시
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Body>
<Add xmlns="http://tempuri.org/">
<a1>1</a1>
<a2>1</a2>
</Add>
</s:Body>
</s:Envelope>
을 결과적으로 내가 받았다있다 folowing 응답 :
HTTP /1.1 500 내부 서버 오류
캐시 제어 : 개인
콘텐츠 길이 : 710
콘텐츠 형식 : 응용 프로그램/xml; 문자셋 = UTF-8
서버 : 마이크로 소프트 IIS/7.5
X-ASPNET-버전 : 4.0.30319
X-구동 - 기준 : ASP.NET
날짜 : 2011년 9월 11일 (일) 16시 34분 19초 GMT
<Fault xmlns="http://schemas.microsoft.com/ws/2005/05/envelope/none">
<Code>
<Value>Sender</Value>
<Subcode>
<Value xmlns:a="http://schemas.microsoft.com/ws/2005/05/addressing/none">
a:ActionNotSupported
</Value>
</Subcode>
</Code>
<Reason>
<Text xml:lang="en-US">
The message with Action '' cannot be processed at the receiver,
due to a ContractFilter mismatch at the EndpointDispatcher.
This may be because of either a contract mismatch
(mismatched Actions between sender and receiver)
or a binding/security mismatch between the sender and the receiver.
Check that sender and receiver have the same contract and the same binding
(including security requirements, e.g. Message, Transport, None).
</Text>
</Reason>
</Fault>
실버 요청 코드 :
BasicHttpBinding basicHttpBinding = new BasicHttpBinding();
EndpointAddress endpointAddress =
new EndpointAddress("http://www.my-site.com/MyService.svc");
IDbService service =
new ChannelFactory<IDbService>(basicHttpBinding, endpointAddress)
.CreateChannel();
AsyncCallback asy = delegate(IAsyncResult result)
{
Trace.WriteLine(service.EndAdd(result));
};
service.BeginAdd(1, 1, asy, null);
실버 운영 계약 인터페이스 :
[ServiceContract]
public interface IMyService
{
[OperationContract(AsyncPattern = true)]
IAsyncResult BeginAdd(long a1, long a2, AsyncCallback callback, object state);
long EndAdd(IAsyncResult result);
}
WCF 운영 계약 인터페이스 :
[ServiceContract]
public interface IMyService
{
[OperationContract]
long Add(long a1, long a2);
}
WCF 서비스 코드 : Web.config의의
[AspNetCompatibilityRequirements(
RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
public class MyService: IMyService
{
public long Add(long a1, long a2)
{
return a1 + a2;
}
}
부분 :
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior name="MySlApp.Web.ServiceMyServiceAspNetAjaxBehavior">
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="true"/>
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name="MySlApp.Web.MyServiceAspNetAjaxBehavior">
<enableWebScript />
</behavior>
</endpointBehaviors>
</behaviors>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true"
multipleSiteBindingsEnabled="true" />
<services>
<service name="MySlApp.Web.DbService"
behaviorConfiguration="MySlApp.Web.ServiceMyServiceAspNetAjaxBehavior">
<endpoint address=""
binding="webHttpBinding" contract="MySlApp.Web.IMyService" />
</service>
</services>
</system.serviceModel>
clientaccesspolicy.xml :
<?xml version="1.0" encoding="utf-8" ?>
<access-policy>
<cross-domain-access>
<policy>
<allow-from http-request-headers="*">
<domain uri="http://www.my-site.com" />
<domain uri="http://www.vkontakte.ru" />
<domain uri="http://*.vkontakte.ru" />
<domain uri="http://www.vk.com" />
<domain uri="http://*.vk.com" />
</allow-from>
<grant-to>
<resource path="/" include-subpaths="true"/>
</grant-to>
</policy>
</cross-domain-access>
</access-policy>
크로스 도메인.xml :
<?xml version="1.0" encoding="utf-8" ?>
<cross-domain-policy>
<allow-access-from domain="www.my-site.com" />
<allow-access-from domain="www.vkontakte.ru" />
<allow-access-from domain="*.vkontakte.ru" />
<allow-access-from domain="www.vk.com" />
<allow-access-from domain="*.vk.com" />
</cross-domain-policy>
당신이 실버 라이트로 만들었습니까 호환되는 WCF 서비스 또는 일반 WCF 서비스? –