0

こんにちは、サーバーの IIS7 で WCF 同期サービスをホストしています。ブラウザーで URL にアクセスできます。実際に WCF サービスを構築し、後で wcf サービス参照を追加して、ソリューションに wcf サービス Web サイトを追加しました。そしてservice.svcファイルで、特定のサービスについて言及しました。wcf サイトの web.config は次のようになります

<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>

誰かがこの問題を解決するのを手伝ってくれませんか

前もって感謝します

4

1 に答える 1

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>

トレース ビューアーは、私がどこで間違っているかを説明してくれました。1 つは、SQL サーバーのセキュリティの問題であり、さらに、Web に接続文字列のプロパティすらありません。configファイル私はwcfサービスに1つ持っていますが、wcf Webサイトにはありません

ご協力ありがとうございました

于 2012-08-30T16:49:41.030 に答える