通用描述
我正在从Silverlight应用程序调用启用Silverlight的WCF服务。我的服务查询数据库( Server)并从中返回值。问题是,该服务使用其他库执行脏数据库工作,而我在尝试使用该服务时得到此异常:
异常
System.ServiceModel.CommunicationException was unhandled by user code Message="An error occurred while trying to make a request to URI 'mysite/myservice.svc'. 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." StackTrace:
at System.ServiceModel.AsyncResult.End[TAsyncResult](IAsyncResult result)
at System.ServiceModel.Channels.ServiceChannel.SendAsyncResult.End(SendAsyncResult result)
at System.ServiceModel.Channels.ServiceChannel.EndCall(String action, Object[] outs, IAsyncResult result)
at System.ServiceModel.ClientBase`1.ChannelBase`1.EndInvoke(String methodName, Object[] args, IAsyncResult result)
at ODP_Silverlight.ODP.WCFServices.PropertySetWcfServiceClient.PropertySetWcfServiceClientChannel.EndGetPropertySet(IAsyncResult result)
at ODP_Silverlight.ODP.WCFServices.PropertySetWcfServiceClient.ODP_Silverlight.ODP.WCFServices.PropertySetWcfService.EndGetPropertySet(IAsyncResult result)
at ODP_Silverlight.ODP.WCFServices.PropertySetWcfServiceClient.OnEndGetPropertySet(IAsyncResult result)
at System.ServiceModel.ClientBase`1.OnAsyncCallCompleted(IAsyncResult result) InnerException: System.Security.SecurityException
Message=""
StackTrace:
at System.Net.Browser.AsyncHelper.BeginOnUI(SendOrPostCallback beginMethod, Object state)
at System.Net.Browser.BrowserHttpWebRequest.EndGetResponse(IAsyncResult asyncResult)
at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelAsyncRequest.CompleteGetResponse(IAsyncResult result)
InnerException: System.Security.SecurityException
Message="Security error."
StackTrace:
at System.Net.Browser.BrowserHttpWebRequest.InternalEndGetResponse(IAsyncResult asyncResult)
at System.Net.Browser.BrowserHttpWebRequest.<>c__DisplayClass5.<EndGetResponse>b__4(Object sendState)
at System.Net.Browser.AsyncHelper.<>c__DisplayClass2.<BeginOnUI>b__0(Object sendState)
InnerException:更多信息
如果我从using mylibs语句中删除“using”,而只返回一些简单的列表,只需几个数字,服务就能正常工作。
有人有洞见吗?
发布于 2009-07-26 13:00:47
使用mylib不调用任何代码。只有mylibs内部的代码才能做到这一点。它似乎正在失败。你应该测试一下。
注意,由于此服务在服务器上运行(而不是在带有SilverLight的浏览器上),所以问题不可能是SilverLight权限。
发布于 2009-07-27 01:51:42
您在WCF服务上实现了ClientAccessPolicy.xml和CrossDomain.xml吗?像您正在接收的CommunicationException可能是由于缺少ClientAccessPolicy.xml文件或不允许Silverlight客户端访问该服务造成的。
https://stackoverflow.com/questions/1184067
复制相似问题