Guest User

Untitled

a guest
Dec 15th, 2018
180
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.20 KB | None | 0 0
  1. The authentication schemes configured on the host ('Basic') do not allow those configured on the binding 'BasicHttpBinding' ('Anonymous'). Please ensure that the SecurityMode is set to Transport or TransportCredentialOnly.
  2.  
  3. <configuration>
  4. <system.web>
  5. <compilation debug="true" targetFramework="4.5" />
  6. <httpRuntime targetFramework="4.5" />
  7. </system.web>
  8. <system.serviceModel>
  9. <behaviors>
  10. <serviceBehaviors>
  11. <behavior name="">
  12. <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
  13. <serviceDebug includeExceptionDetailInFaults="false" />
  14. </behavior>
  15. </serviceBehaviors>
  16. </behaviors>
  17. <serviceHostingEnvironment aspNetCompatibilityEnabled="true"
  18. multipleSiteBindingsEnabled="true" />
  19. </system.serviceModel>
  20. </configuration>
  21.  
  22. <configuration>
  23. <startup>
  24. <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
  25. </startup>
  26. <system.serviceModel>
  27. <bindings>
  28. <basicHttpBinding>
  29. <binding name="BasicHttpBinding_IMyServiceSvc" />
  30. </basicHttpBinding>
  31. </bindings>
  32. <client>
  33. <endpoint address="http://localhost/MyServiceSvc.svc"
  34. binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IMyServiceSvc"
  35. contract="MyServiceSvc.IMyServiceSvc"
  36. name="BasicHttpBinding_IMyServiceSvc" />
  37. </client>
  38. </system.serviceModel>
  39. </configuration>
  40.  
  41. public class BlackHillsCompletionSvcTest
  42. {
  43. static void Main(string[] args)
  44. {
  45. using (var client = new MyServiceSvcClient())
  46. {
  47. var data = new Data
  48. {
  49. id = "1",
  50. description = "test data"
  51. };
  52.  
  53. try
  54. {
  55. var result = client.receiveData(data);
  56. }
  57. catch (Exception ex)
  58. {
  59. var msg = ex.Message;
  60. }
  61. }
  62. }
  63. }
  64.  
  65. <system.serviceModel>
  66. <bindings>
  67. <basicHttpBinding>
  68. <binding name="httpBinding">
  69. <security mode="TransportCredentialOnly">
  70. <transport clientCredentialType="Basic" />
  71. </security>
  72. </binding>
  73. </basicHttpBinding>
  74. </bindings>
  75. ...
  76. </system.serviceModel>
  77.  
  78. The binding at system.serviceModel/bindings/basicHttpBinding does not have a configured binding named 'BasicHttpBinding_IMyServiceSvc'. This is an invalid value for bindingConfiguration.
  79.  
  80. <system.serviceModel>
  81. <bindings>
  82. <basicHttpBinding>
  83. <binding name="BasicHttpBinding_IMyServiceSvc">
  84. <security mode="TransportCredentialOnly">
  85. <transport clientCredentialType="Basic" />
  86. </security>
  87. </binding>
  88. </basicHttpBinding>
  89. </bindings>
  90. ...
  91. </system.serviceModel>
  92.  
  93. The username is not provided. Specify username in ClientCredentials.
  94.  
  95. using (var client = new MyServiceSvcClient())
  96. {
  97. client.ClientCredentials.UserName.UserName = "myusername";
  98. client.ClientCredentials.UserName.Password = "mypassword";
  99. ...
  100. }
  101.  
  102. The requested service, 'http://localhost/MyServiceSvc.svc' could not be activated. Which got me wondering. So I loaded the .svc page in my browser, was asked to log in, and after I did, I saw this:
  103.  
  104. The authentication schemes configured on the host ('Basic') do not allow those configured on the binding 'BasicHttpBinding' ('Anonymous'). Please ensure that the SecurityMode is set to Transport or TransportCredentialOnly. Additionally, this may be resolved by changing the authentication schemes for this application through the IIS management tool, through the ServiceHost.Authentication.AuthenticationSchemes property, in the application configuration file at the <serviceAuthenticationManager> element, by updating the ClientCredentialType property on the binding, or by adjusting the AuthenticationScheme property on the HttpTransportBindingElement.
  105.  
  106. <system.serviceModel>
  107. <bindings>
  108. <basicHttpBinding>
  109. <binding name="httpBinding">
  110. <security mode="TransportCredentialOnly">
  111. <transport clientCredentialType="Basic" />
  112. </security>
  113. </binding>
  114. </basicHttpBinding>
  115. </bindings>
  116. <services>
  117. <service
  118. name="MyServiceSvcNs.MyServiceSvc"
  119. behaviorConfiguration="ServiceWithMetaData"
  120. >
  121. <endpoint name="Default"
  122. address=""
  123. binding="basicHttpBinding"
  124. bindingConfiguration="httpBinding"
  125. contract="MyServiceSvcNs.IMyServiceSvc"
  126. />
  127. </service>
  128. </services>
  129. <behaviors>
  130. <serviceBehaviors>
  131. <behavior name="ServiceWithMetaData">
  132. <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
  133. <serviceDebug includeExceptionDetailInFaults="false" />
  134. </behavior>
  135. </serviceBehaviors>
  136. </behaviors>
  137. <serviceHostingEnvironment aspNetCompatibilityEnabled="true"
  138. multipleSiteBindingsEnabled="true" />
  139. </system.serviceModel>
  140.  
  141. <configuration>
  142. <system.web>
  143. <compilation debug="true" targetFramework="4.5" />
  144. <httpRuntime targetFramework="4.5" />
  145. </system.web>
  146. <system.serviceModel>
  147. <behaviors>
  148. <serviceBehaviors>
  149. <behavior name="">
  150. <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
  151. <serviceDebug includeExceptionDetailInFaults="false" />
  152. </behavior>
  153. </serviceBehaviors>
  154. </behaviors>
  155. <serviceHostingEnvironment aspNetCompatibilityEnabled="true"
  156. multipleSiteBindingsEnabled="true" />
  157. </system.serviceModel>
  158. </configuration>
  159.  
  160. <configuration>
  161. <system.web>
  162. <compilation debug="true" targetFramework="4.5" />
  163. <httpRuntime targetFramework="4.5" />
  164. </system.web>
  165. <system.serviceModel>
  166. <bindings>
  167. <basicHttpBinding>
  168. <binding name="httpTransportCredentialOnlyBinding">
  169. <security mode="TransportCredentialOnly">
  170. <transport clientCredentialType="Basic" />
  171. </security>
  172. </binding>
  173. </basicHttpBinding>
  174. </bindings>
  175. <services>
  176. <service
  177. name="MyServiceSvcNs.MyServiceSvc"
  178. behaviorConfiguration="ServiceWithMetaData"
  179. >
  180. <endpoint name="Default"
  181. address=""
  182. binding="basicHttpBinding"
  183. bindingConfiguration="httpTransportCredentialOnlyBinding"
  184. contract="MyServiceSvcNs.IMyServiceSvc"
  185. />
  186. </service>
  187. </services>
  188. <behaviors>
  189. <serviceBehaviors>
  190. <behavior name="ServiceWithMetaData">
  191. <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
  192. <serviceDebug includeExceptionDetailInFaults="false" />
  193. </behavior>
  194. </serviceBehaviors>
  195. </behaviors>
  196. <serviceHostingEnvironment aspNetCompatibilityEnabled="true"
  197. multipleSiteBindingsEnabled="true" />
  198. </system.serviceModel>
  199. </configuration>
  200.  
  201. <configuration>
  202. <startup>
  203. <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
  204. </startup>
  205. <system.serviceModel>
  206. <bindings>
  207. <basicHttpBinding>
  208. <binding name="BasicHttpBinding_IMyServiceSvc" />
  209. </basicHttpBinding>
  210. </bindings>
  211. <client>
  212. <endpoint address="http://localhost/MyServiceSvc.svc"
  213. binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IMyServiceSvc"
  214. contract="MyServiceSvc.IMyServiceSvc"
  215. name="BasicHttpBinding_IMyServiceSvc" />
  216. </client>
  217. </system.serviceModel>
  218. </configuration>
  219.  
  220. <?xml version="1.0" encoding="utf-8" ?>
  221. <configuration>
  222. <startup>
  223. <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
  224. </startup>
  225. <system.serviceModel>
  226. <bindings>
  227. <basicHttpBinding>
  228. <binding name="httpTransportCredentialOnlyBinding">
  229. <security mode="TransportCredentialOnly">
  230. <transport clientCredentialType="Basic" />
  231. </security>
  232. </binding>
  233. </basicHttpBinding>
  234. </bindings>
  235. <client>
  236. <endpoint
  237. address="http://localhost/MyServiceSvc.svc"
  238. binding="basicHttpBinding"
  239. bindingConfiguration="httpTransportCredentialOnlyBinding"
  240. contract="MyServiceSvc.IMyServiceSvc"
  241. name="BasicHttpBinding_IMyServiceSvc"
  242. />
  243. </client>
  244. </system.serviceModel>
  245. </configuration>
  246.  
  247. <bindings>
  248. <basicHttpBinding>
  249. <binding name="httpBinding">
  250. <security mode="TransportCredentialOnly">
  251. <transport clientCredentialType="Basic" />
  252. </security>
  253. </binding>
  254. </basicHttpBinding>
  255. </bindings>
Add Comment
Please, Sign In to add comment