使用TransportWithMessageLevel凭据和窗体身份验证的WCF配置

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了使用TransportWithMessageLevel凭据和窗体身份验证的WCF配置相关的知识,希望对你有一定的参考价值。

this thing is a pain to configure
  1. <configuration>
  2. <connectionStrings>
  3. <remove name="LocalSqlServer"/>
  4. <add name="LocalSqlServer"
  5. connectionString="Data Source=msapps-qa;Initial Catalog=aspnetdb;UID=blah; Password=blah" providerName="System.Data.SqlClient" />
  6. <add name="blah"
  7. connectionString="data source=.;Integrated Security=false;UID=blah;Password=blah;Initial Catalog=library;" providerName="System.Data.SqlClient"/>
  8. </connectionStrings>
  9. <system.web>
  10. <compilation debug="true" />
  11. <customErrors mode="Off" />
  12. <membership defaultProvider="SqlMembershipProvider" userIsOnlineTimeWindow="15">
  13. <providers>
  14. <clear />
  15. <add
  16. name="SqlMembershipProvider"
  17. type="System.Web.Security.SqlMembershipProvider"
  18. connectionStringName="LocalSqlServer"
  19. applicationName="/"
  20. enablePasswordRetrieval="false"
  21. enablePasswordReset="false"
  22. requiresQuestionAndAnswer="false"
  23. requiresUniqueEmail="true"
  24. passwordFormat="Hashed" />
  25. </providers>
  26. </membership>
  27.  
  28. <!-- Configure the Sql Role Provider -->
  29. <roleManager enabled="true" defaultProvider="SqlRoleProvider">
  30. <providers>
  31. <add connectionStringName="LocalSqlServer" applicationName="/" name="SqlRoleProvider"
  32. type="System.Web.Security.SqlRoleProvider" />
  33. </providers>
  34. </roleManager>
  35.  
  36. <authentication mode="Forms"></authentication>
  37. </system.web>
  38.  
  39. <system.serviceModel>
  40.  
  41. <protocolMapping>
  42. <add scheme="http" binding="wsHttpBinding" />
  43. </protocolMapping>
  44.  
  45. <behaviors>
  46. <serviceBehaviors>
  47. <behavior name="ServiceBehavior">
  48. <serviceAuthorization principalPermissionMode="UseAspNetRoles"
  49. roleProviderName="SqlRoleProvider" />
  50. <serviceCredentials>
  51. <!-- Configure user name authentication to use the Membership Provider -->
  52. <userNameAuthentication userNamePasswordValidationMode="MembershipProvider"
  53. membershipProviderName="SqlMembershipProvider" />
  54.  
  55. <!-- Configure the service certificate -->
  56. <serviceCertificate
  57.  
  58. storeLocation="LocalMachine"
  59. storeName="My"
  60. x509FindType="FindBySubjectName"
  61. findValue="WMSvc-MSAPPS-QA" /> <!--Enter your Server Certificate Name in here-->
  62. </serviceCredentials>
  63. <serviceMetadata httpGetEnabled="false" httpsGetEnabled="true" />
  64. <serviceDebug includeExceptionDetailInFaults="true" />
  65. </behavior>
  66. </serviceBehaviors>
  67. </behaviors>
  68.  
  69. <serviceHostingEnvironment multipleSiteBindingsEnabled="True">
  70. </serviceHostingEnvironment>
  71. <services>
  72. <service name="WCFLibraryService.LibraryService" behaviorConfiguration="ServiceBehavior">
  73. <endpoint address=""
  74. binding="wsHttpBinding"
  75. bindingConfiguration="MembershipBinding"
  76. contract="WCFLibraryService.ILibraryService"
  77. name="ASPmemberUserName"/>
  78. <endpoint address="mex"
  79. binding="mexHttpsBinding"
  80. contract="IMetadataExchange"
  81. bindingConfiguration="">
  82. </endpoint>
  83. </service>
  84. </services>
  85.  
  86. <bindings>
  87. <wsHttpBinding>
  88. <binding name="MembershipBinding" maxReceivedMessageSize="20000000" maxBufferPoolSize="20000000">
  89. <security mode="TransportWithMessageCredential">
  90. <transport clientCredentialType="None" proxyCredentialType="None"></transport>
  91. <message clientCredentialType="UserName" negotiateServiceCredential="true"/>
  92. </security>
  93. </binding>
  94. </wsHttpBinding>
  95. </bindings>
  96.  
  97. </system.serviceModel>
  98. <system.webServer>
  99. <directoryBrowse enabled="true" />
  100. </system.webServer>
  101.  
  102. </configuration>

以上是关于使用TransportWithMessageLevel凭据和窗体身份验证的WCF配置的主要内容,如果未能解决你的问题,请参考以下文章

在使用加载数据流步骤的猪中,使用(使用 PigStorage)和不使用它有啥区别?

今目标使用教程 今目标任务使用篇

Qt静态编译时使用OpenSSL有三种方式(不使用,动态使用,静态使用,默认是动态使用)

MySQL db 在按日期排序时使用“使用位置;使用临时;使用文件排序”

使用“使用严格”作为“使用强”的备份

Kettle java脚本组件的使用说明(简单使用升级使用)