尝试从Silverlight 3页面使用WCF服务时出现安全问题。 [英] Security problem when trying to use a WCF Service from a silverlight 3 page.

查看:62
本文介绍了尝试从Silverlight 3页面使用WCF服务时出现安全问题。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

一般说明


我从Silverlight应用程序调用启用Silverlight的WCF服务。我的服务查询数据库(SQL Server)并从那里返回值。问题是该服务使用其他库来执行脏数据库工作,并且在尝试使用该服务时出现此异常:


异常

   System    ServiceModel  < span class = pun>。  CommunicationException  未处理  by  用户代码 消息  =  "尝试向URI发出请求时发生错误'mysite / myservice.svc"。这可能是由于尝试在没有适当的跨域策略的情况下以跨域方式访问服务,或者是不适合SOAP服务的策略。您可能需要联系服务的所有者以发布跨域策略文件,并确保它允许发送与SOAP相关的HTTP标头。在不使用InternalsVisibleToAttribute属性的情况下,在Web服务代理中使用内部类型也可能导致此错误。有关详细信息,请参阅内部异常。"    StackTrace    
系统 ServiceModel AsyncResult End [ TAsyncResult ]( IAsyncResult result
系统 ServiceModel 频道 ServiceChannel SendAsyncResult End SendAsyncResult result
系统 ServiceModel 频道 ServiceChannel EndCall String action Object [ ] outs IAsyncResult result
System ServiceModel ClientBase `1.ChannelBase ` 1.EndInvoke String methodName Object [] args IAsyncResult 结果
在ODP_Silverlight
ODP WCFServices PropertySetWcfServiceClient PropertySetWcfServiceClientChannel EndGetPropertySet IAsyncResult result
在ODP_Silverlight
ODP WCFServices Prope rtySetWcfServiceClient ODP_Silverlight ODP < span class = pun>。 WCFServices PropertySetWcfService EndGetPropertySet IAsyncResult result
在ODP_Silverlight
ODP WCFServices PropertySetWcfServiceClient OnEndGetPropertySet IAsyncResult result
System ServiceModel ClientBase `1.OnAsyncCallCompleted(IAsyncResult result)InnerException:System.Security.SecurityException
Message ="" ;
StackTrace:
在System.Net.Browser.AsyncHelper.BeginOnUI(SendOrPostCallback beginMethod,Object state)
在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:
在System.Net.Browser.BrowserHttpWebRequest.InternalEndGetResponse(IAsyncResult asyncResult)
在System.Net.Browser.BrowserHttpWebRequest。<> c__DisplayClass5。< EndGetResponse& gt; b__4(Object sendState)
在System.Net.Browser.AsyncHelper。<> c__DisplayClass2。< BeginOnUI> b__0(Object sendState)
InnerException:

更多信息


如果我删除了"使用mylibs "从使用语句,只返回一些简单的List< int>只需几个数字,服务就可以了。


任何见解是谁?


谢谢,


AM。

解决方案

想知道你是否解决了问题,因为我有同样的问题。

谢谢!

General description

I am calling a Silverlight enabled WCF service from a Silverlight application. My service queries a database (SQL Server) and returns values from there. The problem is that the service uses other libraries that do the dirty database work and I get this exception when trying to use the service:

Exception

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:

More info

If I remove the "using mylibs" from the using statements and just return some simple List<int> with a few numbers instead, the service works just fine.

Any insights anyone?

Thanks,

AM.

解决方案

Was wondering if you solved your problem because I have the same one.

thanks!


这篇关于尝试从Silverlight 3页面使用WCF服务时出现安全问题。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆