WCF и исключение System.ServiceModel.ClientBase
От: ilchert  
Дата: 01.10.09 12:11
Оценка:
Доброго времени суток) У меня проблема с сервисом WCF. При обращении клиента к сервису, генерируется исключение "Инициализатор типа "System.ServiceModel.ClientBase`1" выдал исключение" в чём может быть причина ошибки и какие есть методы её устранения? Или хотя бы посоветуйте литературу по этой проблеме.
В целом программа работает следующим образом: клиент обращается к удалённому сервису, а сервис обращается к удалённой базе на MSSQL.

Полный код App.config клиента


<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <system.serviceModel>
        <bindings>
            <wsHttpBinding>
                <binding name="WSHttpBinding_IDictionariesEditService" closeTimeout="00:01:00"
                    openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
                    bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard"
                    maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647"
                    messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true"
                    allowCookies="false">
                    <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
                        maxBytesPerRead="4096" maxNameTableCharCount="16384" />
                    <reliableSession ordered="true" inactivityTimeout="00:10:00"
                        enabled="false" />
                    <security mode="Message">
                        <transport clientCredentialType="Windows" proxyCredentialType="None"
                            realm="" />
                        <message clientCredentialType="Windows" negotiateServiceCredential="true"
                            algorithmSuite="Default" establishSecurityContext="true" />
                    </security>
                </binding>
                <binding name="WSHttpBinding_IDictionariesEditService1" closeTimeout="00:01:00"
                    openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
                    bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard"
                    maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
                    messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true"
                    allowCookies="false">
                    <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
                        maxBytesPerRead="4096" maxNameTableCharCount="16384" />
                    <reliableSession ordered="true" inactivityTimeout="00:10:00"
                        enabled="false" />
                    <security mode="Message">
                        <transport clientCredentialType="Windows" proxyCredentialType="None"
                            realm="" />
                        <message clientCredentialType="Windows" negotiateServiceCredential="true"
                            algorithmSuite="Default" establishSecurityContext="true" />
                    </security>
                </binding>
                <binding name="WSHttpBinding_IDictionariesEditService2" closeTimeout="00:01:00"
                    openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
                    bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard"
                    maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
                    messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true"
                    allowCookies="false">
                    <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
                        maxBytesPerRead="4096" maxNameTableCharCount="16384" />
                    <reliableSession ordered="true" inactivityTimeout="00:10:00"
                        enabled="false" />
                    <security mode="Message">
                        <transport clientCredentialType="Windows" proxyCredentialType="None"
                            realm="" />
                        <message clientCredentialType="Windows" negotiateServiceCredential="true"
                            algorithmSuite="Default" establishSecurityContext="true" />
                    </security>
                </binding>
            </wsHttpBinding>
        </bindings>
        <client>
            <endpoint address="http://localhost:8731/Design_Time_Addresses/Astu.Dekanat.Dictionaries.Services/DictionariesEditService/"
                binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IDictionariesEditService1"
                contract="WcfDictionaries.IDictionariesEditService" name="WSHttpBinding_IDictionariesEditService">
                <identity>
                    <userPrincipalName value="l.roskov@agtu.ru" />
                </identity>
            </endpoint>
            <endpoint address="http://localhost:8731/Design_Time_Addresses/Astu.Dekanat.Dictionaries.Services/DictionariesEditService2/"
                binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IDictionariesEditService2"
                contract="WcfDictionaries2.IDictionariesEditService2" name="WSHttpBinding_IDictionariesEditService2">
                <identity>
                    <userPrincipalName value="l.roskov@agtu.ru" />
                </identity>
            </endpoint>
        </client>
    </system.serviceModel>
</configuration>



Полный текст App.config сервиса


<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <system.web>
    <compilation debug="true" />
  </system.web>
  <system.serviceModel>
    <bindings>
      <wsHttpBinding>
        <binding name = "wsHttpBinding2" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647">
        </binding>
      </wsHttpBinding>
    </bindings>
    <services>
      
      <service behaviorConfiguration="Astu.Dekanat.Dictionaries.Services.MainBehavior"
        name="Astu.Dekanat.Dictionaries.Services.DictionariesEditService">
        <endpoint address="" binding="wsHttpBinding"  bindingConfiguration="wsHttpBinding2" contract="Astu.Dekanat.Dictionaries.Services.IDictionariesEditService" >
        </endpoint>
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
        <host>
          <baseAddresses>
            <add baseAddress="http://localhost:8731/Design_Time_Addresses/Astu.Dekanat.Dictionaries.Services/DictionariesEditService/" />
          </baseAddresses>
        </host>
      </service>

      <service behaviorConfiguration="Astu.Dekanat.Dictionaries.Services.MainBehavior"
        name="Astu.Dekanat.Dictionaries.Services.DictionariesEditService2">
        <endpoint address="" binding="wsHttpBinding"  bindingConfiguration="wsHttpBinding2" contract="Astu.Dekanat.Dictionaries.Services.IDictionariesEditService2" >
        </endpoint>
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
        <host>
          <baseAddresses>
            <add baseAddress="http://localhost:8731/Design_Time_Addresses/Astu.Dekanat.Dictionaries.Services/DictionariesEditService2/" />
          </baseAddresses>
        </host>
      </service>
      
    </services>
    <behaviors>
      <serviceBehaviors>
        <behavior name="Astu.Dekanat.Dictionaries.Services.MainBehavior">
          <serviceMetadata httpGetEnabled="true" />
          <serviceDebug includeExceptionDetailInFaults="true" />
          <serviceThrottling maxConcurrentCalls="160" maxConcurrentSessions="100"
            maxConcurrentInstances="260" />
        </behavior>
      </serviceBehaviors>
    </behaviors>
  </system.serviceModel>
</configuration>
 
Подождите ...
Wait...
Пока на собственное сообщение не было ответов, его можно удалить.