2011-06-08 90 views
3

我花了幾個小時在這個,並根本無法讓它工作。也許我對託管WCF服務和爲其創建客戶端的理解不正確。從另一臺電腦訪問WCF服務

我的網站上有一個WCF服務添加到它,用下面的配置...

<system.serviceModel> 

<bindings> 
    <wsHttpBinding> 
    <binding name="Binding1"> 
     <security mode="None"> 
     <transport clientCredentialType="None" /> 
     <message establishSecurityContext="false" /> 
     </security> 
    </binding> 
    </wsHttpBinding> 
</bindings> 

    <behaviors> 
     <serviceBehaviors> 
      <behavior name="MyWCFWebApp.Service1Behavior"> 
       <serviceMetadata httpGetEnabled="true"/> 
       <serviceDebug includeExceptionDetailInFaults="false"/> 
      </behavior> 
     </serviceBehaviors> 
    </behaviors> 

    <services> 
     <service behaviorConfiguration="MyWCFWebApp.Service1Behavior" name="MyWCFWebApp.Service1"> 
      <endpoint address="" binding="wsHttpBinding" contract="MyWCFWebApp.IService1" bindingConfiguration="Binding1"> 
      </endpoint> 
      <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/> 
     </service> 
    </services> 

</system.serviceModel> 

當我運行通過使用Visual Studio中建立Web服務器的網站,我可以通過http://localhost:9988/Service1.svc

訪問web服務

但是......

當主機通過cassiniDev服務器的網站,綁定IP和主機名,我可以當我嘗試使用我訪問WCF服務通過http://localhost:9988/Service1.svc訪問WCF服務,但p或主機名http://10.111.202.73:9988/Service1.svc,它返回以下錯誤:

「沒有協議綁定匹配給定的地址'http://10.111.202.73:9988/Service1.svc'。協議綁定在IIS站點級別配置或WAS配置。」

我不知道爲什麼會這樣。任何想法?

+0

IP 10.111.202.73:9988來自哪裏? – 2011-06-08 03:12:26

+0

我的帖子中有一些瑕疵,我編輯它10.111.202.73是IP地址本地計算機試圖通過ip地址而不是localhost訪問wcf服務。它與wcf服務運行的pc相同。 – FaNIX 2011-06-08 03:44:54

+0

這似乎是一個WCF和cassini的錯誤:(沒有可用的解決方案http://ultidev.com/Forums/default.aspx?g=posts&t=351 – FaNIX 2011-06-08 05:08:25

回答

1

因此,原來的問題是cassinidev Web服務,它不支持WCF 3.5相關....我花了一段的數字,一出來......

0

也許你可以嘗試託管服務在一個控制檯應用程序,只作爲測試,看看它的相關的IIS。