2012-08-30 91 views
0

嗨我有一個WCF同步服務託管IIS7在我的服務器上,我可以訪問瀏覽器中的URL,其實我建立了WCF服務,後來我添加了一個wcf服務網站到我的解決方案,通過添加我的wcf服務參考。並在service.svc文件中提到了特定的服務。在WCF網站的web.config看起來像遠程服務器返回錯誤:(404)未找到。 WCF Web異常

<configuration> 
    <system.serviceModel> 
    <services> 
     <service behaviorConfiguration="ServiceBehavior" name="SimGuru_WCF.SimGuruDBCacheSyncService"> 
     <endpoint address="" binding="basicHttpBinding" bindingConfiguration="" 
      contract="SimGuru_WCF.ISimGuruDBCacheSyncContract"> 
      <identity> 
      <dns value="localhost" /> 
      </identity> 
     </endpoint> 
     <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" /> 
     </service> 
    </services> 
    <behaviors> 
     <serviceBehaviors> 
     <behavior name="ServiceBehavior"> 
      <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment --> 
      <serviceMetadata httpGetEnabled="true"/> 
      <!-- 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> 

當我試圖訪問它給我的「遠程服務器返回錯誤:(404)未找到」的服務,但仍我可以訪問通過URL 而app.config文件服務

<configuration> 

    <configSections> 
    </configSections> 
    <connectionStrings> 
    <add name="SimGuru_WCF.Properties.Settings.ServerSimGuru_RetailConnectionString" 
     connectionString="Data Source=SIMGURU\SQLEXPRESS;Initial Catalog=SimGuru_Retail;Integrated Security=True" 
     providerName="System.Data.SqlClient" /> 
    </connectionStrings> 
    <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> 
    <bindings> 
     <basicHttpBinding> 
     <binding name="BasicHttpBinding_ISimGuruDBCacheSyncContract" closeTimeout="00:01:00" 
      openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" 
      allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" 
      maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536" 
      messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered" 
      useDefaultWebProxy="true"> 
      <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" 
      maxBytesPerRead="4096" maxNameTableCharCount="16384" /> 
      <security mode="None"> 
      <transport clientCredentialType="None" proxyCredentialType="None" 
       realm="" /> 
      <message clientCredentialType="UserName" algorithmSuite="Default" /> 
      </security> 
     </binding> 
     </basicHttpBinding> 
    </bindings> 
    <services> 
     <service behaviorConfiguration="SimGuru_WCF.SimGuruDBCacheSyncServiceBehavior" 
     name="SimGuru_WCF.SimGuruDBCacheSyncService"> 
     <endpoint address="" binding="basicHttpBinding" contract="SimGuru_WCF.ISimGuruDBCacheSyncContract"> 
      <identity> 
      <dns value="10.0.1.42"/> 
      </identity> 
     </endpoint> 
     <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" /> 
     <host> 
      <baseAddresses> 
      <add baseAddress="http://10.0.1.42:8731/SimGuruDBCacheSyncService/" /> 
      </baseAddresses> 
      <timeouts closeTimeout="00:01:10" openTimeout="00:09:00" /> 
     </host> 
     </service> 
    </services> 
    <behaviors> 
     <serviceBehaviors> 
     <behavior name="SimGuru_WCF.SimGuruDBCacheSyncServiceBehavior"> 
      <!-- To avoid disclosing metadata information, 
      set the value below to false and remove the metadata endpoint above before deployment --> 
      <serviceMetadata httpGetEnabled="True"/> 
      <!-- 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> 
    <system.diagnostics> 
    <sources> 
     <source name="System.ServiceModel" 
       switchValue="Information, ActivityTracing" 
       propagateActivity="true"> 
     <listeners> 
      <add name="traceListener" 
       type="System.Diagnostics.XmlWriterTraceListener" 
       initializeData="c:\log\Traces.svclog" /> 
     </listeners> 
     </source> 
    </sources> 
    </system.diagnostics> 
</configuration> 

可以有一個人請幫我提前解決這問題出

感謝

+0

請新增服務客戶端的配置。 –

+0

其實我建立了服務器和客戶端,我的本地系統,這是一個使用本地數據庫緩存的wcf同步服務。現在我又添加了一個wcf服務網站,併爲此添加了對wcf項目的引用,即我在服務器上放置了不同的計算機,同時訪問服務時它給了我這個錯誤 – Srikanth

+0

將10.0.1.42替換爲localhost –

回答

0

我得到了它,使用跟蹤我能整理我的問題

<diagnostics> 
         <messageLogging maxMessagesToLog="30000" 
           logEntireMessage="true" 
           logMessagesAtServiceLevel="true" 
           logMalformedMessages="true" 
           logMessagesAtTransportLevel="true"> 
         </messageLogging> 
       </diagnostics> 
    </system.serviceModel> 
<system.diagnostics> 
       <sources> 
         <source name="System.ServiceModel" 
           switchValue="Verbose, ActivityTracing" 
           propagateActivity="true" > 
           <listeners> 
             <add name="xml" /> 
           </listeners> 
         </source> 
         <source name="System.ServiceModel.MessageLogging" 
           switchValue="Verbose"> 
           <listeners> 
             <add name="xml" /> 
           </listeners> 
         </source> 
       </sources> 
       <sharedListeners> 
         <add name="xml" 
           type="System.Diagnostics.XmlWriterTraceListener" 
           initializeData="e2eTraceTest.e2e" /> 
       </sharedListeners> 
       <trace autoflush="true" /> 
     </system.diagnostics> 

跟蹤查看解釋我哪裏做錯了一件事是與SQL服務器的安全問題,多過我甚至不在我的網絡中有一個連接字符串屬性。配置文件我有一個關於WCF服務但不能在WCF網站 任何它是如何解決

感謝大家的通力合作

相關問題