New Posts New Posts RSS Feed: Silverlight app LoginManager confusion
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

Forum LockedSilverlight app LoginManager confusion

 Post Reply Post Reply
Author
cbordeman View Drop Down
Newbie
Newbie
Avatar

Joined: 15-Mar-2010
Location: U.S.
Posts: 5
Post Options Post Options   Quote cbordeman Quote  Post ReplyReply Direct Link To This Post Topic: Silverlight app LoginManager confusion
    Posted: 16-Mar-2010 at 11:46am
In my SL 3 client, after calling mgr.LoginAsync() I am getting this exception:

[IdeaBlade.EntityModel.LoginException] = {LoginException: LoginManager is required but failed to find one. --->
   at IdeaBlade.EntityModel.RemoteEntityServerProxy.CheckConnection(Exception pException)
   at IdeaBlade.EntityModel.EntityServerProxy.Login(ILoginCredential credential)
   at IdeaB...

After reading the documentation, I'm a bit confused where to implement the LoginManager.  I created a .Net (not SL) assembly 'MyApp.Servers' and put my class in there, using only GenericIdentity and GenericPrincipal, and marked the class [Serializable] just in case.

In my web site, I added a reference to my 'MyApp.Servers' to it and added it to the probed assemblies in web.config.  (<probeAssemblyName name="MyApp.Servers" />).  I also added the same to the probed assemblies on the app.config

Unfortunately the provided documentation and samples provide no guidance on Silverlight security or PersistenceManager (which I'm not using yet).

Please help, and talk slow! :)
Back to Top
cbordeman View Drop Down
Newbie
Newbie
Avatar

Joined: 15-Mar-2010
Location: U.S.
Posts: 5
Post Options Post Options   Quote cbordeman Quote  Post ReplyReply Direct Link To This Post Posted: 16-Mar-2010 at 1:42pm
Ok I figured out that the LoginManager (not just custom iidentity or iprincipal) needs to be marked with the [DiscoverableType(DiscoverableTypeMode.KnownType)] attribute.  Now I get this error:

The remote server returned an error: NotFound. If running in Visual Studio, make sure CopyLocal=true is set for all IdeaBlade assembly references in the web project to ensure that these assemblies are copied to the bin folder. To check if the service is running, open your internet browser and navigate to 'http://localhost:21791/EntityService.svc'. If the service page shows errors, these should help diagnose the problem with the service. If the service is running, then also make sure that the endpoint bindings match between client and server.

Stack Trace:
   at IdeaBlade.EntityModel.EntityManager.HandleEntityServerException(Exception pException, Boolean pTryToHandle, PersistenceOperation pOperation)
   at IdeaBlade.EntityModel.EntityManager.<ConnectCoreAsync>b__27(AsyncEventArgs args)
   at IdeaBlade.EntityModel.AsyncProcessor`1.<Execute>b__1(Object x)

I am sure my MyApp.Servers' is added to the web project's references and 'Copy Local' is true and it is in the bin folder.  I also browsed to http://localhost:21791/EntityService.svc as suggested, and it seems to be running.  I don't know where to check endpoint bindings for the service, don't see anything in web.config or app.config (SL) for that.
Back to Top
cbordeman View Drop Down
Newbie
Newbie
Avatar

Joined: 15-Mar-2010
Location: U.S.
Posts: 5
Post Options Post Options   Quote cbordeman Quote  Post ReplyReply Direct Link To This Post Posted: 17-Mar-2010 at 9:36am
I'm still unable to get past this error.  Here is my web.config's service config, based on the sample provided in LearningResources.  Someone please take a look.

<!-- =========== WCF hosting section ==============
     In IIS and WAS, service setup must be done using the System.ServiceModel section.
   -->
  <system.serviceModel>

    <!-- Define the EntityService, and a "prototype" EntityServer here.
           If you have multiple EntityServers, define only the one service here,
           by its type name, and create a *.svc for each.  Do not modify the
         service names or endpoint information.
     -->
    <services>
      <service name="EntityService">
        <endpoint
              address=""
              binding="customBinding" bindingConfiguration="compressedBinaryBinding"
              contract="IdeaBlade.EntityModel.IEntityServiceContract" />
      </service>

      <service name="IdeaBlade.EntityModel.Server.EntityServer">
        <endpoint
              address=""
              binding="customBinding" bindingConfiguration="compressedBinaryBinding"
              contract="IdeaBlade.EntityModel.IEntityServerContract" />
      </service>
    </services>

    <!-- You can use the gzipMessageEncoding binding element for compressed binary encoding.
           Only the httpTransport or httpsTransport may be used with IIS.
           Some reader quotas and the maxReceivedMessageSize properties have been set to
           maximum values here, but can be reduced based on your site needs. Other properties
           are allowed to default here, but you may set as needed. 
           Additional binding elements may also be added.
        -->
    <bindings>
      <customBinding>
        <binding name="compressedBinaryBinding">
          <gzipMessageEncoding>
            <readerQuotas maxArrayLength="2147483647" maxDepth="2147483647" maxStringContentLength="2147483647" />
          </gzipMessageEncoding>
          <httpTransport maxReceivedMessageSize="2147483647"/>
        </binding>
      </customBinding>

    </bindings>

    <!-- gzipMessageEncoding is used with the compressedBinaryBinding above. -->
    <extensions>
      <bindingElementExtensions>
        <add name="gzipMessageEncoding" type="IdeaBlade.Core.Wcf.Extensions.GZipMessageEncodingElement, IdeaBlade.Core"/>
      </bindingElementExtensions>
    </extensions>

    <!-- Diagnostics can be used during development.  See system.diagnostics section below.
           Note that having diagnostics on can drastically reduce performance!!!  Be sure to turn
           this off when you don't need it!
        -->
    <diagnostics>
      <messageLogging logEntireMessage="true" logMalformedMessages="true" logMessagesAtServiceLevel="true" logMessagesAtTransportLevel="true"/>
    </diagnostics>
  </system.serviceModel>
Back to Top
cbordeman View Drop Down
Newbie
Newbie
Avatar

Joined: 15-Mar-2010
Location: U.S.
Posts: 5
Post Options Post Options   Quote cbordeman Quote  Post ReplyReply Direct Link To This Post Posted: 17-Mar-2010 at 9:37am
Application logs, WCF logs, and DebugLog.xml show no errors.
Back to Top
cbordeman View Drop Down
Newbie
Newbie
Avatar

Joined: 15-Mar-2010
Location: U.S.
Posts: 5
Post Options Post Options   Quote cbordeman Quote  Post ReplyReply Direct Link To This Post Posted: 17-Mar-2010 at 9:46am
OK finally figured it out.  Silverlight clients don't support custom bindings.  Here is my final system.serviceModel for web.config.

<!-- =========== WCF hosting section ==============
     In IIS and WAS, service setup must be done using the System.ServiceModel section.
   -->
  <System.ServiceModel>
    <services>
      <service name="EntityService">
        <endpoint address="" binding="customBinding" bindingConfiguration="customBinaryBinding" contract="IdeaBlade.EntityModel.IEntityServiceContract" />
      </service>
      <service name="IdeaBlade.EntityModel.Server.EntityServer">
        <endpoint address="" binding="customBinding" bindingConfiguration="customBinaryBinding" contract="IdeaBlade.EntityModel.IEntityServerContract" />
      </service>
    </services>
    <bindings>
      <!--The default binding in the Silverlight app is http with binary encoding. Max values are set here for testing; you should adjust to your application's requirements. If you modify the binding here, be sure to also create/modify the ServiceReferences.ClientConfig in the Silverlight application too. Both the client and server sides must agree on the binding configuration in order for communications to succeed. -->
      <customBinding>
        <binding name="customBinaryBinding">
          <binaryMessageEncoding>
            <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" />
          </binaryMessageEncoding>
          <httpTransport maxReceivedMessageSize="2147483647" maxBufferSize="2147483647" />
        </binding>
      </customBinding>
    </bindings>

    <!-- Diagnostics can be used during development.  See system.diagnostics section below.
           Note that having diagnostics on can drastically reduce performance!!!  Be sure to turn
           this off when you don't need it!
        -->
    <diagnostics>
      <messageLogging logEntireMessage="true" logMalformedMessages="true" logMessagesAtServiceLevel="true" logMessagesAtTransportLevel="true"/>
    </diagnostics>

  </System.ServiceModel>
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down