c# - Membership.Provider for mysql in asp.net issue -
using mvc4 synced mysql server. did changing machine.config , used asp.net configuration tool create users. when log in username created using tool (and in database) error
system.invalidoperationexception unhandled user code message=to call method, "membership.provider" property must instance of "extendedmembershipprovider". source=webmatrix.webdata stacktrace: @ webmatrix.webdata.websecurity.verifyprovider() @ webmatrix.webdata.websecurity.login(string username, string password, boolean persistcookie) @ khswebsite.controllers.accountcontroller.login(loginmodel model, string returnurl) in c:\users\alex\documents\visual studio 2010\projects\khswebsite\khswebsite\controllers\accountcontroller.cs:line 38 @ lambda_method(closure , controllerbase , object[] ) @ system.web.mvc.actionmethoddispatcher.execute(controllerbase controller, object[] parameters) @ system.web.mvc.reflectedactiondescriptor.execute(controllercontext controllercontext, idictionary`2 parameters) @ system.web.mvc.controlleractioninvoker.invokeactionmethod(controllercontext controllercontext, actiondescriptor actiondescriptor, idictionary`2 parameters) @ system.web.mvc.async.asynccontrolleractioninvoker.<>c__displayclass42.<begininvokesynchronousactionmethod>b__41() @ system.web.mvc.async.asyncresultwrapper.<>c__displayclass8`1.<beginsynchronous>b__7(iasyncresult _) @ system.web.mvc.async.asyncresultwrapper.wrappedasyncresult`1.end() @ system.web.mvc.async.asynccontrolleractioninvoker.endinvokeactionmethod(iasyncresult asyncresult) @ system.web.mvc.async.asynccontrolleractioninvoker.<>c__displayclass37.<>c__displayclass39.<begininvokeactionmethodwithfilters>b__33() @ system.web.mvc.async.asynccontrolleractioninvoker.<>c__displayclass4f.<invokeactionmethodfilterasynchronously>b__49() innerexception:
this fresh database fresh mvc4 razor web site vs2010. thoughts?
update: here web.config
<?xml version="1.0" encoding="utf-8"?> <configuration> <configsections> <section name="entityframework" type="system.data.entity.internal.configfile.entityframeworksection, entityframework, version=4.4.0.0, culture=neutral, publickeytoken=b77a5c561934e089" requirepermission="false" /> </configsections> <connectionstrings> <remove name="localmysqlserver"/> <add name="localmysqlserver" connectionstring="datasource=localhost;database=khs;uid=root;pwd=power1739;" providername="mysql.data.mysqlclient"/> </connectionstrings> <appsettings> <add key="webpages:version" value="2.0.0.0" /> <add key="webpages:enabled" value="false" /> <add key="preserveloginurl" value="true" /> <add key="clientvalidationenabled" value="true" /> <add key="unobtrusivejavascriptenabled" value="true" /> <add key="enablesimplemembership" value="true" /> </appsettings> <system.web> <rolemanager defaultprovider="mysqlroleprovider"/> <membership defaultprovider="mysqlmembershipprovider" /> <compilation debug="true" targetframework="4.0" /> <authentication mode="forms"> <forms loginurl="~/account/login" timeout="2880" /> </authentication> <pages> <namespaces> <add namespace="system.web.helpers" /> <add namespace="system.web.mvc" /> <add namespace="system.web.mvc.ajax" /> <add namespace="system.web.mvc.html" /> <add namespace="system.web.optimization" /> <add namespace="system.web.routing" /> <add namespace="system.web.webpages" /> </namespaces> </pages> </system.web> <system.webserver> <validation validateintegratedmodeconfiguration="false" /> <modules runallmanagedmodulesforallrequests="true" /> <handlers> <remove name="extensionlessurlhandler-isapi-4.0_32bit" /> <remove name="extensionlessurlhandler-isapi-4.0_64bit" /> <remove name="extensionlessurlhandler-integrated-4.0" /> <add name="extensionlessurlhandler-isapi-4.0_32bit" path="*." verb="get,head,post,debug,put,delete,patch,options" modules="isapimodule" scriptprocessor="%windir%\microsoft.net\framework\v4.0.30319\aspnet_isapi.dll" precondition="classicmode,runtimeversionv4.0,bitness32" responsebufferlimit="0" /> <add name="extensionlessurlhandler-isapi-4.0_64bit" path="*." verb="get,head,post,debug,put,delete,patch,options" modules="isapimodule" scriptprocessor="%windir%\microsoft.net\framework64\v4.0.30319\aspnet_isapi.dll" precondition="classicmode,runtimeversionv4.0,bitness64" responsebufferlimit="0" /> <add name="extensionlessurlhandler-integrated-4.0" path="*." verb="get,head,post,debug,put,delete,patch,options" type="system.web.handlers.transferrequesthandler" precondition="integratedmode,runtimeversionv4.0" /> </handlers> </system.webserver> <runtime> <assemblybinding xmlns="urn:schemas-microsoft-com:asm.v1"> <dependentassembly> <assemblyidentity name="system.web.helpers" publickeytoken="31bf3856ad364e35" /> <bindingredirect oldversion="1.0.0.0-2.0.0.0" newversion="2.0.0.0" /> </dependentassembly> <dependentassembly> <assemblyidentity name="system.web.mvc" publickeytoken="31bf3856ad364e35" /> <bindingredirect oldversion="1.0.0.0-4.0.0.0" newversion="4.0.0.0" /> </dependentassembly> <dependentassembly> <assemblyidentity name="system.web.webpages" publickeytoken="31bf3856ad364e35" /> <bindingredirect oldversion="1.0.0.0-2.0.0.0" newversion="2.0.0.0" /> </dependentassembly> </assemblybinding> </runtime> <entityframework> <defaultconnectionfactory type="system.data.entity.infrastructure.sqlconnectionfactory, entityframework" /> </entityframework> </configuration>
asp.net mvc simple membership not same normal web forms membership provider. check following blog post. linked article
- simplemembership integrates previous membership system, can't use membershipprovider simplemembership
- asp.net 4.5 web forms not use simplemembership; implements oauth on top of asp.net membership
see following image:
from exception, understood provider classic membership provider , not compatible simple membership.
"membership.provider" property must instance of "extendedmembershipprovider".
you can following post1,post2 mysql compatible asp.net mvc simple membership provider.
Comments
Post a Comment