wcf服务wsHttpBinding over Internet

时间:2013-01-10 12:15:41

标签: c# wcf soap

你好试图让我的绑定工作在互联网上。 即时通讯使用wsHttpBinding并试图让它与肥皂一起使用。 我已经尝试过NetTcpBinding,并通过我的公共IP将我的功能显示在wcftestclient上,并将我的端口发送到正确的计算机,但我无法调用任何失败的函数: enter image description here

我不认为soap可以与NetTcpBinding一起使用所以我一直在尝试使这个配置工作

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <system.serviceModel>
    <services>
      <service
        behaviorConfiguration="VenatoWCF.Behavior"
        name="VenatoWCF.WCFService">
        <endpoint
          address=""
          binding="wsHttpBinding"
          contract="VenatoWCF.IService"
          bindingConfiguration="Binding">
        </endpoint>
        <endpoint
          address="mex"
          binding="mexHttpBinding"
          contract="IMetadataExchange">
        </endpoint>

        <host>
          <baseAddresses>
            <add baseAddress="http://localhost:8734/WCF/" />
          </baseAddresses>
        </host>
      </service>
    </services>
    <behaviors>
      <serviceBehaviors>
        <behavior name="VenatoWCF.Behavior">
          <serviceMetadata httpGetEnabled="true" />
          <useRequestHeadersForMetadataAddress />
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <bindings>
      <wsHttpBinding>
        <binding name="Binding" >
          <security mode="Message">
            <transport clientCredentialType="None"/>
          </security>
        </binding>
      </wsHttpBinding>
    </bindings>
  </system.serviceModel>
  <startup>
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0,Profile=Client"/>
  </startup>
</configuration>

这可以用肥皂消费,但是这个配置我不能用soap或wcftestclient得到任何反应。

肥皂:致命错误:未捕获的SoapFault异常:[WSDL] SOAP-ERROR:解析WSDL:无法从“http://(My外部ip加载”:8734 / WCF /?wsdl':无法加载外部实体“http://(My外部IP):8734 / WCF /?wsdl”

谢谢你的回答

EDIT1抱歉错误的配置文件,以便谁能够快速查看:/

EDIT2

在我的wsdl文件中发现,在底部我有<soap:address location="https://dendei:8734/WCF/" /> isent一个应该是一个soap连接也需要"https://(my external ip):8734/WCF/" ???

我怎么能改变这一个?在配置文件中?还是在我的程序中?

EDIT3

在搜索UseRequestHeadersForMetadataAddressBehavior

时偶然发现了这个网站

并解决了它的局部问题所以我可以在我的baseaddress <add baseAddress="https://localhost:8734/WCF/"/>

中使用localhost

它和肥皂一起使用,所以我收回了它试图连接的地址

并在网上工作:)

但是使用UseRequestHeadersForMetadataAddressBehavior你必须使用.NET 4.0

2 个答案:

答案 0 :(得分:0)

您的错误消息表明您使用此Url http://(My External ip):8734/WCF/?wsdl通过WcfTestClient连接到您的服务。但是您在配置文件中定义了不同的Url。看看你的baseAddress。试试这个网址http://(My External ip):8734/Venato/mex?wsdl

答案 1 :(得分:0)

如果我切换到4.0并使用UseRequestHeadersForMetadataAddressBehavior而不是尝试访问wsdl文件并更改指向本地地址的soap:地址仍然不知道如何执行此操作,那么可以正常工作。 :)

并且连接问题出现在我的计算机防火墙中阻止连接路由器接受了连接并且我自己的计算机阻止了它xD

将使用适合我欢呼的配置编辑我的任务!