In my application for generating and downloading the files to the server location and saving the files information we are using WCF and Sql Server, Entity Framework with Repository Pattern.
Call to WCF happens when we enter the count (In UI) of files to be generated using WCF, it will vary from 1-10000, If I enter the count < 7000 there are no errors but if the count is > 7000 i am getting error in WCF -
EXCEPTION: System.Data.Entity.Infrastructure.DbUpdateException: An error occurred while updating the entries. See the inner exception for details. ---> System.Data.Entity.Core.UpdateException: An error occurred while updating the entries. See the inner exception for details. ---> System.InvalidOperationException: The transaction associated with the current connection has completed but has not been disposed.
The transaction must be disposed before the connection can be used to execute SQL statements.
I am assuming this error is due to the DB Timeout.
WCF method used for generating the files my C# code -
[ServiceContract]
public interface IRFService
{
[OperationContract(IsOneWay = true)]
void RequestForBulkPrint(Guid orderId);
WCF configuration -
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior>
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="false"/>
<serviceTimeouts transactionTimeout="00:20:00"/>
</behavior>
</serviceBehaviors>
</behaviors>
<protocolMapping>
<add binding="basicHttpsBinding" scheme="https"/>
</protocolMapping>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true"/>
</system.serviceModel>
I have reference of business layer dll in WCF to reuse the other logics.
So the structure of application is like below -
Web API -> Service Integration -> Business Layer -> WCF (For generating the files) -> Business Layer (For generating the files) -> Repository layer (using Entity Framework) -> Sql Server Database.
Error i am getting in business layer (called from WCF), if the count > 7000. Since there are multiple update calls happening as per our business logic, error line is inconsistent.
Please let me know if this error is because of time out in WCF and please guide how to go about it.