code_junkie

Why, when I impersonate within a WCF service, can my service not load System.Transactions when I try to run a LINQ to SQL query?

Nov 12th, 2011
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.88 KB | None | 0 0
  1. [OperationBehavior(Impersonation = ImpersonationOption.Allowed)]
  2. public void MyOperation(int arg)
  3.  
  4. <behavior name="ReceivingServiceBehavior">
  5. <!-- Other behaviors -->
  6. <serviceAuthorization impersonateCallerForAllOperations="true" />
  7. </behavior>
  8.  
  9. <?xml version="1.0" encoding="utf-8" ?>
  10. <configuration>
  11. <system.serviceModel>
  12.  
  13. <!-- .... -->
  14.  
  15. <behaviors>
  16. <endpointBehaviors>
  17. <behavior name="ImpersonationBehavior">
  18. <clientCredentials>
  19. <windows allowedImpersonationLevel="Impersonation" />
  20. </clientCredentials>
  21. </behavior>
  22. </endpointBehaviors>
  23. </behaviors>
  24. </system.serviceModel>
  25. </configuration>
  26.  
  27. <?xml version="1.0" encoding="utf-8" ?>
  28. <configuration>
  29. <system.serviceModel>
  30.  
  31. <!-- .... -->
  32.  
  33. <behaviors>
  34. <endpointBehaviors>
  35. <behavior name="ImpersonationBehavior">
  36. <clientCredentials>
  37. <windows allowedImpersonationLevel="Impersonation" />
  38. </clientCredentials>
  39. </behavior>
  40. </endpointBehaviors>
  41. </behaviors>
  42. </system.serviceModel>
  43. </configuration>
  44.  
  45. <system.serviceModel>
  46. <serviceHostingEnvironment aspNetCompatibilityEnabled="false" />
  47. <services>
  48. <service behaviorConfiguration="SymitarService.ScheduleServiceBehavior" name="SymitarService.ScheduleService">
  49. <endpoint address="" binding="wsHttpBinding" bindingConfiguration="wsSecure" contract="SymitarService.IScheduleService">
  50. <identity>
  51. <dns value="localhost" />
  52. </identity>
  53. </endpoint>
  54. <endpoint address="mex" binding="wsHttpBinding" bindingConfiguration="wsSecure" contract="IMetadataExchange" />
  55. </service>
  56. </services>
  57. <behaviors>
  58. <serviceBehaviors>
  59. <behavior name="SymitarService.UserDirectoryBehavior">
  60. <serviceMetadata httpGetEnabled="true" />
  61. <serviceDebug includeExceptionDetailInFaults="true" />
  62. <serviceAuthorization impersonateCallerForAllOperations="true" />
  63. </behavior>
  64. <behavior name="SymitarService.ScheduleServiceBehavior">
  65. <serviceMetadata httpGetEnabled="true" />
  66. <serviceDebug includeExceptionDetailInFaults="true" />
  67. <serviceAuthorization impersonateCallerForAllOperations="true" />
  68. </behavior>
  69. </serviceBehaviors>
  70. </behaviors>
  71. <bindings>
  72. <netTcpBinding>
  73. <binding name="tcpSecure" portSharingEnabled="true" />
  74. </netTcpBinding>
  75. <wsHttpBinding>
  76. <binding name="wsSecure" allowCookies="true">
  77. <security mode="Transport">
  78. <transport clientCredentialType="Windows" proxyCredentialType="Windows" />
  79. <message clientCredentialType="Windows" negotiateServiceCredential="true" />
  80. </security>
  81. </binding>
  82. </wsHttpBinding>
  83. <mexTcpBinding>
  84. <binding name="mexSecure" />
  85. </mexTcpBinding>
  86. </bindings>
  87. </system.serviceModel>
  88.  
  89. <system.serviceModel>
  90. <bindings>
  91. <wsHttpBinding>
  92. <binding name="WSHttpBinding_IScheduleService" closeTimeout="01:00:00" openTimeout="01:00:00" receiveTimeout="01:00:00" sendTimeout="01:00:00" bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="524288" maxReceivedMessageSize="65536" useDefaultWebProxy="true" allowCookies="true">
  93. <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384" />
  94. <reliableSession ordered="true" inactivityTimeout="00:20:00" enabled="false" />
  95. <security mode="Transport">
  96. <transport clientCredentialType="Windows" proxyCredentialType="Windows" realm="" />
  97. <message clientCredentialType="Windows" negotiateServiceCredential="true" establishSecurityContext="true" />
  98. </security>
  99. </binding>
  100. </wsHttpBinding>
  101. </bindings>
  102. <behaviors>
  103. <endpointBehaviors>
  104. <behavior name="ImpersonationBehavior">
  105. <clientCredentials>
  106. <windows allowedImpersonationLevel="Impersonation" allowNtlm="true"/>
  107. </clientCredentials>
  108. </behavior>
  109. </endpointBehaviors>
  110. </behaviors>
  111. <client>
  112. <endpoint address="https://server:444/SymitarService/ScheduleService.svc"
  113. binding="wsHttpBinding"
  114. bindingConfiguration="WSHttpBinding_IScheduleService"
  115. contract="Symitar.ScheduleService.IScheduleService"
  116. name="WSHttpBinding_IScheduleService"
  117. behaviorConfiguration="ImpersonationBehavior"
  118. >
  119. <identity>
  120. <dns value="localhost" />
  121. </identity>
  122. </endpoint>
  123. </client>
  124. </system.serviceModel>
  125.  
  126. [OperationBehavior(Impersonation:=ImpersonationOption.Required)]
Add Comment
Please, Sign In to add comment