首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用其他程序集时调用Silverlight启用WCF服务的异常

使用其他程序集时调用Silverlight启用WCF服务的异常
EN

Stack Overflow用户
提问于 2009-07-26 08:53:49
回答 2查看 2.5K关注 0票数 0

通用描述

我正在从Silverlight应用程序调用启用Silverlight的WCF服务。我的服务查询数据库( Server)并从中返回值。问题是,该服务使用其他库执行脏数据库工作,而我在尝试使用该服务时得到此异常:

异常

代码语言:javascript
复制
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”,而只返回一些简单的列表,只需几个数字,服务就能正常工作。

有人有洞见吗?

EN

回答 2

Stack Overflow用户

发布于 2009-07-26 13:00:47

使用mylib不调用任何代码。只有mylibs内部的代码才能做到这一点。它似乎正在失败。你应该测试一下。

注意,由于此服务在服务器上运行(而不是在带有SilverLight的浏览器上),所以问题不可能是SilverLight权限。

票数 0
EN

Stack Overflow用户

发布于 2009-07-27 01:51:42

您在WCF服务上实现了ClientAccessPolicy.xml和CrossDomain.xml吗?像您正在接收的CommunicationException可能是由于缺少ClientAccessPolicy.xml文件或不允许Silverlight客户端访问该服务造成的。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/1184067

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档