Securing an ADO.net WCF data service with ASP.NET Membership
HI,
I am using WCF DataServices, i am trying to securing it using asp.net membership
here is my code,
<system.serviceModel>
<bindings>
<wsHttpBinding>
<binding name="SecureWSBindingWithMembershipConfig" >
<security mode="TransportWithMessageCredential">
<transport clientCredentialType="None" />
<message clientCredentialType="UserName"/>
</security>
</binding>
</wsHttpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior name="SecureServiceWithMembershipBehavior">
<serviceMetadata httpsGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
<serviceAuthorization principalPermissionMode="UseAspNetRoles" roleProviderName="AspNetSqlRoleProvider" />
<serviceCredentials>
<userNa开发者_开发技巧meAuthentication userNamePasswordValidationMode="MembershipProvider" membershipProviderName="AspNetSqlMembershipProvider" />
</serviceCredentials>
</behavior>
</serviceBehaviors>
</behaviors>
<services>
<service name="DataService.WcfDataService" behaviorConfiguration="SecureServiceWithMembershipBehavior">
<endpoint address="WcfDataService.svc" binding="wsHttpBinding" contract="System.Data.Services.IRequestHandler" bindingConfiguration="SecureWSBindingWithMembershipConfig" >
<!--<identity>
<dns value="" />
</identity>-->
</endpoint>
<endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange" />
</service>
</services>
</system.serviceModel>
I am getting following error:
The operation 'ProcessRequestForMessage' could not be loaded because it has a parameter or return type of type System.ServiceModel.Channels.Message or a type that has MessageContractAttribute and other parameters of different types. When using System.ServiceModel.Channels.Message or types with MessageContractAttribute, the method must not use any other types of parameters.
You can try this, if this is almost like your code:
Method(RequestMessage request, OtherType value)
// Your message contract much like this.
[MessageContract]
public class RequestMessage {
[MessageBodyMember]
public OtherType { get; set; }
}
// And your new method will be
Method(RequestMessage request)
精彩评论