locked
WCF giving error: An existing connection was forcibly closed by the remote host RRS feed

  • Question

  • User170691248 posted

    Hi,

    I am trying to connect database thru WCF, but I am getting the error 

    "An existing connection was forcibly closed by the remote host wcf".

    My webconfig is

    <configuration>

    <system.web>

    <compilation debug="true" targetFramework="4.0" />
    </system.web>
    <system.serviceModel>
    <behaviors>
    <serviceBehaviors>
    <behavior>
    <dataContractSerializer maxItemsInObjectGraph="2147483646"/>
    <!-- To avoid disclosing metadata information, set the value below to false 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="true"/>
    </behavior>
    </serviceBehaviors>
    </behaviors>
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
    </system.serviceModel>
    <system.webServer>
    <modules runAllManagedModulesForAllRequests="true"/>
    <!--
    To browse web app root directory during debugging, set the value below to true.
    Set to false before deployment to avoid disclosing web app folder information.
    -->
    <directoryBrowse enabled="true"/>
    </system.webServer>
    <connectionStrings>
    <add name="DBConnection" connectionString="Data Source=mycoonection settings"/>
    </connectionStrings>

    </configuration>

    Monday, August 26, 2013 3:35 AM

Answers

  • User-488622176 posted

    This kind of errors is mostly related to exceptions thrown by a WCF service internals. Put a try-catch around your service implementation code, and throw a faultexception to the client with meaningfull exception info. This will show you what went wrong.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, August 26, 2013 7:24 AM

All replies

  • User170691248 posted

    It seems, to retrieve datatable, there is another method which i don't know.

    I tried returning dataset, worked fine.

    Monday, August 26, 2013 5:50 AM
  • User-488622176 posted

    This kind of errors is mostly related to exceptions thrown by a WCF service internals. Put a try-catch around your service implementation code, and throw a faultexception to the client with meaningfull exception info. This will show you what went wrong.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, August 26, 2013 7:24 AM