WCF服务调用在Intranet中正常工作,但在internet中不能正常工作

WCF服务调用在Intranet中正常工作,但在internet中不能正常工作,wcf,silverlight,iis,Wcf,Silverlight,Iis,我已经使用silverlight应用程序一个多月了,偶然发现了一个奇怪的问题。 我有一个在IIS中运行的WCF服务,可从URL访问: 我能够在VisualStudio中使用它,当从VisualStudio部署时,能够从WCF服务获得适当的回调,并且一切正常。 当我将包文件部署到与IIS中的Service1.svc相同的文件夹中时,WCF服务未正常运行 请帮助我解决此问题:(!这是我的web.config文件 <?xml version="1.0"?> <!-- For m

我已经使用silverlight应用程序一个多月了,偶然发现了一个奇怪的问题。 我有一个在IIS中运行的WCF服务,可从URL访问:

我能够在VisualStudio中使用它,当从VisualStudio部署时,能够从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>

我不知道我哪里出错了。但是当通过内联网访问时,相同的虚拟文件夹可以正常工作,但当通过互联网访问时,就不工作了:(请帮助

编辑: 在检查客户端配置后,我发现Visual studio自动将URL解析为intranet URL。当我更改回internet URL时,引发了一个异常

n尝试向URI的“”发出请求时出错https://xyztestname.com/Service1.svc“。这可能是由于在没有适当的跨域策略或策略不适合SOAP服务的情况下试图以跨域方式访问服务。您可能需要与服务的所有者联系以发布跨域策略。”y文件,以确保允许发送与SOAP相关的HTTP头。此错误也可能是由于在web服务代理中使用内部类型而未使用InternalsVisibleToAttribute属性造成的。有关详细信息,请参阅内部异常


但是,我已将crossdomain和clientaccesspolicy文件复制到IIS中应用程序的根目录中。:(请帮助。

您必须将应用程序部署到特定的ip和端口才能在internet中使用它。 我想你可以

为此,您需要手动编辑applicationhost.config文件(编辑绑定信息“:”)

要启动iisexpress,您需要管理员权限

1 – Bind your application to your public IP address
通常,当您在IIS Express中运行应用程序时,只能在http://localhost:[someport]。为了从另一台计算机访问它,它还需要绑定到您的公共IP地址。打开D:\Users[YourName]\Documents\IISExpress\config\applicationhost.config并找到您的站点。您将发现类似以下内容:

 <site name="YOUR PROJECT NAME HERE" id="2">
     <application path="/"> 
     <virtualDirectory path="/" physicalPath="YOUR PHYSICAL PATH HERE"
             <binding protocol="http" bindingInformation="*:58938:localhost" />
    </bindings>
</site> 
如果您运行的是Windows 7,则几乎所有传入连接都已锁定,因此您需要专门允许应用程序的传入连接。首先,启动管理命令提示符。其次,运行这些命令,用您正在使用的任何IP和端口替换192.168.1.42:58938:

netsh http添加urlacl url=http://192.168.1.42:58938/ 用户=所有人

这只是告诉http.sys可以与此url对话

netsh advfirewall firewall add rule name=“IISExpressWeb”dir=in protocol=tcp localport=58938 profile=private remoteip=localsubnet action=allow

这在Windows防火墙中添加了一条规则,允许本地子网上的计算机连接到端口58938


现在,您可以在Visual Studio中按Ctrl-F5,并从另一台计算机浏览您的站点!

您必须在相应字段中替换您的ip和计算机名,这样您就完成了。但请记住关闭IISEXpress的防火墙
   <binding protocol="http" bindingInformation="*:58938:192.168.1.42" /> 
    2 - Allow incoming connections