0
繼續與this後 我創建WCF
項目主機服務我的機器上從本教程: http://www.aspdotnet-suresh.com/2011/06/introduction-to-wcf-wcf-tutorial-wcf.html 我的機器上我WCF
服務運行,我不能連接後我的客戶到我的服務並收到EndPointNotFoundException
(這發生在本地和遠程機器上),如果我的服務通過visual studio運行,則不是這種情況。 什麼可能會導致此錯誤?客戶端無法連接只有當服務從Windows服務運行主機WCF服務
的App.config:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.web>
<compilation debug="true" />
</system.web>
<!-- When deploying the service library project, the content of the config file must be added to the host's
app.config file. System.Configuration does not support config files for libraries. -->
<system.serviceModel>
<services>
<service name="WCFService.Service1">
<host>
<baseAddresses>
<add baseAddress = "http://localhost:8733/Service1/" />
</baseAddresses>
</host>
<!-- Service Endpoints -->
<!-- Unless fully qualified, address is relative to base address supplied above -->
<endpoint address="" binding="basicHttpBinding" contract="WCFService.IService1">
<!--
Upon deployment, the following identity element should be removed or replaced to reflect the
identity under which the deployed service runs. If removed, WCF will infer an appropriate identity
automatically.
-->
<identity>
<dns value="localhost"/>
</identity>
</endpoint>
<!-- Metadata Endpoints -->
<!-- The Metadata Exchange endpoint is used by the service to describe itself to clients. -->
<!-- This endpoint does not use a secure binding and should be secured or removed before deployment -->
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior>
<!-- To avoid disclosing metadata information,
set the value below to false before deployment -->
<serviceMetadata httpGetEnabled="False"/>
<!-- To receive exception details in faults for debugging purposes,
set the value below to true. Set to false before deployment
to avoid disclosing exception information -->
<serviceDebug includeExceptionDetailInFaults="False" />
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
</configuration>
你如何主辦服務? – CodeCaster
你是什麼意思?也許帳戶= NetworkService?請看第4步:http://msdn.microsoft.com/en-us/library/ff649818.aspx – user2813889
因此,您可以在Windows服務中自行託管WCF服務。您在哪個網址可以訪問?它使用你的'app.config'嗎?端口是否可以通過防火牆訪問? – CodeCaster