Answer the question
In order to leave comments, you need to log in
Using a global transaction in a WCF project?
Hello. I'm trying to use a global transaction for a service and a client (I need data to be written to the database, on the client and on the server, and if an error occurs somewhere, then the data is rolled back).
I'm using TransactionScope, but I'm getting the error:
Network access for Distributed Transaction Manager (MSDTC) has been disabled. Please enable DTC for network access in the security configuration for MSDTC using the Component Services Administrative tool
I know how to solve this problem (you need to enable DTC), but the problem is that this thing needs to be enabled on every client computer, which is not good because there are a lot of computers.
The question is:Are there any other ways to use a global transaction (i.e. on the service and on the client) or maybe some config settings and not to put any additional checkboxes on the clients?
Below is an example service.
Web.config
<system.serviceModel>
<services>
<service name="WcfService1.Service1" behaviorConfiguration="behaviorStandart">
<endpoint contract="WcfService1.IService1" address="" bindingConfiguration="bindingWsHttp" binding="wsHttpBinding" ></endpoint>
</service>
</services>
<bindings>
<wsHttpBinding>
<binding name="bindingWsHttp" closeTimeout="00:10:00" openTimeout="00:10:00" maxBufferPoolSize="2147483647"
receiveTimeout="00:10:00" sendTimeout="00:10:00" maxReceivedMessageSize="2147483647" transactionFlow="true">
<readerQuotas maxArrayLength="2147483647" maxStringContentLength="2147483647"/>
<reliableSession inactivityTimeout="10:00:30" ordered="true" enabled="true" />
<security mode="None" />
</binding>
</wsHttpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior name="behaviorStandart">
<dataContractSerializer maxItemsInObjectGraph="65536"/>
<serviceMetadata httpGetEnabled="true" />
<serviceDebug httpHelpPageEnabled="false" includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
</system.serviceModel>
[ServiceContract]
public interface IService1
{
[OperationContract]
[TransactionFlow(TransactionFlowOption.Allowed)]
void AddData(String name);
}
[OperationBehavior(TransactionScopeRequired = true)]
public void AddData(String name)
{
//code
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question