none
Can not start Publishing wizard when using custom membership provider with HTML Client. RRS feed

  • Question

  • I have added in the server project a class that inherits from MembershipProvider. This class is not in a namespace.

    I have also updated the Web.Config file. Below is what I wrote.

        <membership defaultProvider="MySQLAuthorizationProvider">
          <providers>
            <clear />
            <add name="MySQLMembershipProvider" type="MySqlAuthorizationProvider" connectionStringName="_IntrinsicData" applicationName="BarMOS" requiresUniqueEmail="false" requiresQuestionAndAnswer="false" />
          </providers>
    

    When I run the solution from inside VS 2012 everything works fine. When I select to publish the wizard does not start and I see a message box informing me that:

    The following exception was thrown trying to publish: Could not load type 'MySQLAuthorizationProvider' from assembly 'System.Web, Version=4.0.0.0 etc etc etc.

    Notice that it looks for my provider in System.Web. How come?

    Anyone has experienced this? Thank you.

    Friday, June 14, 2013 8:10 PM

Answers

  • Notice that the value is "<TypeNamespace>.<TypeName>, <AssemblyName>, Version=<AssemblyVersion>, Culture=<AssemblyCulture>, PublicKeyToken=<AssemblyPublicKeyToken>" and not, what you have written, "<AssemblyName>.<TypeName>".

    You may want to build your membership provider in a separate assembly and reference it from the server project. The reason is that the version of all of the projects in a LightSwitch application are incremented every time you publish. So placing it in it's own assembly will prevent you from needing to manually increment the version in the web.config every time you want to publish.


    Justin Anderson, LightSwitch Development Team

    Saturday, June 15, 2013 8:09 PM
    Moderator

All replies

  • You need to specify the fully qualified type name for the type property, for example:

    <add name="AspNetMembershipProvider" type="Microsoft.LightSwitch.Security.ServerGenerated.Implementation.WindowsUserMembershipProvider, Microsoft.LightSwitch.Base.Server, Version=11.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" connectionStringName="_IntrinsicData" applicationName="Application1" />


    Justin Anderson, LightSwitch Development Team

    Saturday, June 15, 2013 8:52 AM
    Moderator
  • I tried that already. For the server project the assembly name is Application.Server so I change the type to Application.Server.MySQLAuthorizationProvider. If I do that, not only the publish wizard does not start but also it doesn't work inside VS when I rum the solution.

    For my situation having a custom Membership Provider inside the server project what you were going to write to type because every combination I tried it doesn't work.


    Saturday, June 15, 2013 9:46 AM
  • Notice that the value is "<TypeNamespace>.<TypeName>, <AssemblyName>, Version=<AssemblyVersion>, Culture=<AssemblyCulture>, PublicKeyToken=<AssemblyPublicKeyToken>" and not, what you have written, "<AssemblyName>.<TypeName>".

    You may want to build your membership provider in a separate assembly and reference it from the server project. The reason is that the version of all of the projects in a LightSwitch application are incremented every time you publish. So placing it in it's own assembly will prevent you from needing to manually increment the version in the web.config every time you want to publish.


    Justin Anderson, LightSwitch Development Team

    Saturday, June 15, 2013 8:09 PM
    Moderator
  • I see.

    Thank you very much for your reply. It put me on the right way.

    Sunday, June 16, 2013 1:21 PM
  • Just faced this problem, for me

    The lightswitch html client project build and debugging ok,

    But when i'm choose on project -> publish and then it gives error:

    The following exception was thrown trying to publish:

    Could not load file assembly "sisiMembershipProvider, Version=1.0.0.0, Culture=neutral,PublicKeyToken=90ae26a077372089" or one of its dependencies.

    Could you help with it.

    Sunday, June 30, 2013 11:38 AM
  • I am having the exact same problem. Here is my webConfig info:

    <add name="AspNetMembershipProvider" type="CustomProvider.Implementation, CustomProvider, Version=1.0.0.0, Culture=neutral, PublicKeyToken=f420ebc3a73c9c5e" connectionStringName="_IntrinsicData" applicationName="AuthTestApp" />

    Any help would be appreciated!

    Mitch

    Thursday, July 4, 2013 6:46 PM
  • I ended up adding the custom DLL to the GAC.. and the error went away. I also deployed successfully and the app seems to be working.

    Hope that helps


    • Edited by DeLux_247 Friday, July 5, 2013 12:54 PM poor spelling
    Thursday, July 4, 2013 9:50 PM