저는 며칠 동안이 문제로 어려움을 겪었습니다.이 WCF 서비스를 올바르게 구성하여 맞춤 멤버십 공급자를 사용할 수 없습니다.WCF 구성 - 호스트의 사용자 지정 인증
The username/password Membership provider MidlandsCoop.MembersWcfService.Business.UserAuthentication specified in the configuration is invalid. No such provider was found registered under system.web/membership/providers.
나는 아무 소용이 MSDN link 다음되었습니다 내가 테스트 클라이언트를 불 때 나는이 오류가 발생합니다. 아무도 내가 잘못 가고 있다고 말할 수 있습니까? 다음과 같이
<?xml version="1.0"?> <configuration> <connectionStrings> <add name="MyCS" connectionString="Data Source=my server;Initial Catalog=MyDB;Integrated Security=True" providerName="System.Data.SqlClient"/> </connectionStrings> <system.web> <compilation debug="true" targetFramework="4.0" /> </system.web> <system.serviceModel> <bindings> <wsHttpBinding> <binding name="wsHttpBinding"> <security> <message clientCredentialType="UserName" /> </security> </binding> </wsHttpBinding> </bindings> <services> <service name="MidlandsCoop.MembersWcfService.MembersService" behaviorConfiguration="Service_Behaviour"> <endpoint address="" binding="basicHttpBinding" bindingConfiguration="" name="basicHttpBinding" contract="MidlandsCoop.MembersWcfService.IMembersService" /> <endpoint binding="wsHttpBinding" bindingConfiguration="wsHttpBinding" name="wsHttpBinding" contract="MidlandsCoop.MembersWcfService.IMembersService" /> <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" /> </service> </services> <behaviors> <serviceBehaviors> <behavior name="Service_Behaviour"> <serviceMetadata httpGetEnabled="true" /> <serviceDebug includeExceptionDetailInFaults="false" /> <serviceCredentials> <userNameAuthentication userNamePasswordValidationMode="Custom" membershipProviderName="MidlandsCoop.MembersWcfService.Business.UserAuthentication" /> </serviceCredentials> </behavior> </serviceBehaviors> </behaviors> <serviceHostingEnvironment multipleSiteBindingsEnabled="true" aspNetCompatibilityEnabled="true" /> </system.serviceModel> <system.webServer> <modules runAllManagedModulesForAllRequests="true" /> </system.webServer> </configuration>
내 사용자 인증 클래스는 다음과 같습니다 :
여기 내 Web.config의의
public class UserAuthentication : UserNamePasswordValidator
{
public override void Validate(string userName, string password)
{
if (null == userName || null == password)
{
throw new ArgumentNullException();
}
var db = new PetaPoco.Database("MyDB");
db.Fetch<dynamic>("SELECT Username, Password FROM MyTable WHERE [email protected] AND Password [email protected]",
userName, password);
}
}
어떤 제안을 크게 감상 할 수있다.
는 customUserNamePasswordValidatorType = "MidlandsCoop.MembersWcfService.Business.UserAuthentication" – vibhu
이 링크 http://msdn.microsoft.com/en-us/library/ms731315에 membershipProviderName = "MidlandsCoop.MembersWcfService.Business.UserAuthentication"로 변경하려고합니다. aspx는 요소의 속성을 언급합니다. 아직 보지 않은 경우 참조하십시오. –
vibhu
응답 해 주셔서 감사합니다. 이제이 오류가 발생합니다. 'System.ServiceModel, Version = 4.0.0.0, Culture = neutral, PublicKeyToken = b77a5c561934e089'어셈블리에서 'MidlandsCoop.MembersWcfService.Business.UserAuthentication'유형을로드 할 수 없습니다. – Brett