我已经使用 Silverlight 应用程序一个多月了,并且偶然发现了一个奇怪的问题。我有一个在 IIS 中运行的 WCF 服务,可从以下 URL 访问: https ://xyztestname.com/service1.svc
我能够在 Visual Studio 中使用它,当从 Visual Studio 部署时,能够从 WCF 服务获得正确的回调,并且一切正常。当我将包文件部署到与 IIS 中的 Service1.svc 相同的文件夹中时,WCF 服务没有正确命中。
请帮我解决这个问题:(!这是我的 web.config 文件。
<?xml version="1.0"?>
<!--
For more information on how to configure your ASP.NET application, please visit
http://go.microsoft.com/fwlink/?LinkId=169433
-->
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0" />
<customErrors mode="Off"/>
</system.web>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpEndpointBinding">
<security mode="TransportCredentialOnly">
<transport clientCredentialType="None" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<services>
<service name="InformationService.Service1">
<endpoint address="" binding="basicHttpBinding" bindingConfiguration="BasicHttpEndpointBinding"
name="BasicHttpEndpoint" contract="InformationService.IService1">
</endpoint>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
</system.serviceModel>
</configuration>
我不知道我哪里出错了。但是通过 Intranet 访问时相同的虚拟文件夹可以正常工作,但通过 Internet 访问时无法正常工作:(请帮助。
编辑: 检查客户端配置后,我发现 Visual Studio 自动将 URL 解析为 Intranet URL。当我改回 Internet URL 时,我收到了一个异常。
尝试向 URI 'https://xyztestname.com/Service1.svc' 发出请求时发生错误。这可能是由于在没有适当的跨域策略或不适合 SOAP 服务的策略的情况下尝试以跨域方式访问服务。您可能需要联系服务的所有者以发布跨域策略文件并确保它允许发送与 SOAP 相关的 HTTP 标头。此错误也可能是由于在 Web 服务代理中使用内部类型而不使用 InternalsVisibleToAttribute 属性造成的。有关更多详细信息,请参阅内部异常。
但是,我已将跨域和 clientaccesspolicy 文件复制到 IIS 中应用程序的根目录中。:( 请帮忙。