2012-12-04 67 views
3

我有一个Silverlight应用程序托管在包含WCF SOAP Web服务的asp.net Web应用程序上。该应用程序使用SSL在HTTPS:// ...链接下运行。当我在运行IIS 7.5的测试服务器上部署它时,一切正常,并且正如预期的那样。 我还有第二个Web应用程序,包括在本地计算机和提及的测试服务器上使用SSL运行的RESTful WCF服务(但本例中没有Silverlight客户端)。调试IIS Express Web服务/ Silverlight应用程序时的安全错误

我的问题是,Silverlight客户端在应该发生反序列化的部分从SOAP服务获取响应时收到安全错误,但只能在本地计算机上收到。

return base.Channel.EndGet...(IAsyncResult) // <-- exception reported here: 
 
    System.ServiceModel.CommunicationException: An error occurred while 
    trying to make a request to URI 'https://localmachinename.domain.com:8000/Service.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. ---> System.Security.SecurityException ---> 
    System.Security.SecurityException: Security error.  
    at System.Net.Browser.BrowserHttpWebRequest.InternalEndGetResponse(IAsyncResult asyncResult) 
    at System.Net.Browser.BrowserHttpWebRequest.c__DisplayClassa.b__9(Object sendState) 
    at System.Net.Browser.AsyncHelper.c__DisplayClass4.b__0(Object sendState) 
    --- End of inner exception stack trace --- 
    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) 
    --- End of inner exception stack trace --- 
    at System.ServiceModel.Channels.Remoting.RealProxy.Invoke(Object[] args) 
    at proxy_2.EndGetTypes(IAsyncResult) 
    at NameSpace.ClientClass.ServiceContractInterfaceImplementation.EndGetTypes(IAsyncResult result) 

我clientaccesspolicy.xml SOAP服务看起来是这样的:

<?xml version="1.0" encoding="utf-8" ?> 
<access-policy> 
    <cross-domain-access> 
    <policy> 
     <allow-from http-request-headers="SOAPAction"> 
     <domain uri="*" /> 
     </allow-from> 
     <grant-to> 
     <resource path="/" include-subpaths="true"/> 
     </grant-to> 
    </policy> 
    </cross-domain-access> 
</access-policy> 

任何提示什么,我做错了什么? 已部署的应用程序在我们的测试Web服务器上运行良好。

2012年12月6日:问题仍然存在。一些更新/更多信息:
Web服务使用Windows身份验证和模拟。测试服务器和本地计算机之间唯一的区别在于,应用程序池运行在不同的身份下,在两种情况下都是技术域用户。我发现唯一的区别是我的本地机器上的用户没有被授予Active Directory中的“可信委派”标志。所以我认为它可能是一个Kerberos问题。但是,当我运行我宁静的WCF服务和客户端时,这从来都不是问题。此外,为SOAP服务使用一个windows窗体客户端,我的本地机器上的所有内容都可以正常运行,并且按照预期开发/调试是可能的。
所以它必须是一个Silverlight问题。
我不明白的是,假设这种可怕的安全错误是由跨域策略问题导致的,就像它在大多数情况下一样,这些域在哪里交叉?一切都应该在本地机器上开展,没有其他服务被调用。这应该不会发生使用IIS Express,应该吗?
任何人都可以帮忙吗?

回答

0

的clientaccesspolicy.xml应放置在wwroot文件夹,还包括crossdomain.xml

+0

我尝试在应用程序根目录中添加一个crossdomain.xml,但无济于事。 –

+0

我甚至会绝望地把两个都放在wwwroot中,但我很不确定它会在哪里运行** IIS Express ** ... –

0

如果您在溶液中具有多重启动项目确保你正在运行的服务和适当的Silverlight项目。我有两个silverlight项目,并开始错误的没有包含clientaccesspolicy.xml。

相关问题