使用WebClient成功将我的silverlight应用程序连接到Webservice,但是试图通过SOAP连接它。
总是得到一些关于跨域策略,InternalsVisibleTo或完全信任程序集列表的巨大且不确定的例外......
我有clientaccesspolicy.xml,因为WebClient连接正常工作。那么我还需要调整什么?
private void Test_Click(object sender, RoutedEventArgs e)
{
Profile_local.ProfileSoapClient psc = new ProfileSoapClient();
Profile_local.Profile prf = new Profile_local.Profile();
psc.GetProfilesSOAPCompleted += psc_Completed;
psc.GetProfilesSOAPAsync("lilid,lipstic");
}
void psc_Completed(object sender, Profile_local.GetProfilesSOAPCompletedEventArgs e)
{
Profile_local.Profile prf = e.Result[0];
txt.Text = prf.Name;
}
例外,在自动生成的SoapChanel Reference.cs:
中触发public Profile[] EndGetProfilesSOAP(System.IAsyncResult result) {
object[] _args = new object[0];
Profile[] _result = ((Profile[])(base.EndInvoke("GetProfilesSOAP", _args, result)));
return _result;
}