2014-09-29 38 views
0

運行我有一個WP 8的應用程序消耗在我的IIS 8主辦如果我運行從VS2013的應用程序,並選擇在設備或模擬器WCF服務的應用程序工作正常。如果我部署應用程序,並運行應用程序從設備直接,該應用程序顯示錯誤:WP 8 WCF錯誤當設備

Object reference not set to an instance of an object.Stack. tRACE: System.ServiceModel.Channels.ServiceChannel.ThrowIfFaultUnderstood(MessageReply, MessageFault fault, String action, MessageVersion version)...

這裏是我的我的WCF服務的app.config:

<services> 
    <service behaviorConfiguration="Metadata" name="WCFDataLibrary.EnvioDados"> 
    <clear /> 
    <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" 
     listenUriMode="Explicit"> 
     <identity> 
     <dns value="http://192.168.1.5" /> 
     <certificateReference storeName="My" storeLocation="LocalMachine" 
      x509FindType="FindBySubjectDistinguishedName" /> 
     </identity> 
    </endpoint> 
    <endpoint 
     address="http://192.168.1.5/wcfdatasite/EnvioDados.svc" 
     binding="basicHttpBinding" 
     contract="WCFDataLibrary.IEnvioDados"/> 
    <host> 
     <baseAddresses> 
     <!--<add baseAddress="http://localhost:8080/WCFDataService" />--> 
     <add baseAddress="http://192.168.1.5/WCFDataService/EnvioDados" /> 
    </baseAddresses> 
    </host> 
    </service> 
</services> 

就像我說的,一切當我在VS2013上運行設備上的應用程序時運行良好,但當我將應用程序部署到同一設備並僅使用設備的無線運行應用程序時,該應用程序無法工作。

+1

這看起來並不像一個外部IP地址... – McGarnagle 2014-09-29 15:37:26

+0

@McGarnagle雖然你是正確的,OP會出現問題發佈應用程序時,OP不說,如果他在本地網絡中測試應用程序,是什麼會沒事的。 – Herdo 2014-09-29 15:38:48

+0

對不起,但什麼是OP? – 2014-09-29 15:51:22

回答

0

的問題是在serviceMetadata配置。

原來的關鍵是:

<serviceMetadata httpGetEnabled="true" httpGetUrl="http://192.168.1.5/WCFDataService/meta"/> 

和正確的值必須是:

<serviceMetadata httpGetEnabled="true" httpGetUrl="http://192.168.1.5/WCFDataService/meta?wsdl" /> 

現在,它的工作完美!