Silverlight Example

Dec 23, 2008 at 5:21 AM
I've tried to convert Example to Silverlight but receive an Error:

"Error: Sys.InvalidOperationException: Managed RuntimeError error #4004 in control 'dnn_ctr386_View_SilverlightControl.
Sys.InvalidOperationException: Could not file default endpoint element that references contract IWebCF.IWebTabManager in the
ServiceModule client configuration section.  This might be because no configuration file was found for your application, or because no endpoint
element matching this contract could be found in the client element at
Systen.ServiceModuleDescription.ConfigLoader.LoadChannelBehaviors
(ServiceEndpoint serviceEndpoint, String ConfigurationName)
at System.ServiceModel.ChannelFactoryApplyConfiguration(String configurationName) ..... "


DesktopModules\web.config
====================
<?xml version="1.0"?>
<configuration>
  <system.web>
    <!--<httpRuntime maxRequestLength="2097151" />-->
    <webServices>
    </webServices>
    <webControls clientScriptsLocation="/aspnet_client/{0}/{1}/" />
    <httpRuntime executionTimeout="1500" maxRequestLength="512000" />
  </system.web>
  <system.serviceModel>
    <bindings>
      <basicHttpBinding>
        <binding name="basicHttpBinding" />
        <binding name="mtomHttpBinding" receiveTimeout="00:25:00" sendTimeout="00:25:00" maxBufferSize="524288000" maxReceivedMessageSize="524288000" messageEncoding="Mtom">
          <readerQuotas maxArrayLength="524288000" />
        </binding>
      </basicHttpBinding>
      <ws2007HttpBinding>
        <binding name="ws2007HttpBinding">
          <security mode="None">
            <transport clientCredentialType="None" />
            <message clientCredentialType="UserName" />
          </security>
        </binding>
      </ws2007HttpBinding>
      <mexHttpBinding>
        <binding name="mexHttpBinding" />
      </mexHttpBinding>
    </bindings>
    <behaviors>
      <serviceBehaviors>
        <behavior name="DefaultBehavior">
          <serviceMetadata httpGetEnabled="true" />
          <workflowRuntime />
          <serviceDebug includeExceptionDetailInFaults="true" />
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" />
    <services>
      <service behaviorConfiguration="DefaultBehavior" name="DotNetNuke.Modules.IWebCF.CoreService">
        <endpoint address="IWebFileManager" binding="ws2007HttpBinding" bindingConfiguration="ws2007HttpBinding" name="IWebFileManager" contract="DotNetNuke.Modules.IWebCF.IWebFileManager" />
        <endpoint address="IWebTabManager" binding="ws2007HttpBinding" bindingConfiguration="ws2007HttpBinding" name="IWebTabManager" contract="DotNetNuke.Modules.IWebCF.IWebTabManager" />
        <endpoint address="IWebUserManager" binding="ws2007HttpBinding" bindingConfiguration="ws2007HttpBinding" name="IWebUserManager" contract="DotNetNuke.Modules.IWebCF.IWebUserManager" />
        <endpoint address="IFSI" binding="ws2007HttpBinding" bindingConfiguration="ws2007HttpBinding" name="IFSI" contract="DotNetNuke.Modules.IWebCF.IFSI" />
        <endpoint address="IWebFileTransferManager" binding="basicHttpBinding" bindingConfiguration="mtomHttpBinding" name="IWebFileTransferManager" contract="DotNetNuke.Modules.IWebCF.IWebFileTransferManager" />
        <endpoint binding="ws2007HttpBinding" bindingConfiguration="ws2007HttpBinding" name="CoreService" contract="DotNetNuke.Modules.IWebCF.IWebCoreService" />
      </service>
    </services>
  </system.serviceModel>
</configuration>


C# code:
======

            IWebCF.WebTabManagerClient client = new IWebCF.WebTabManagerClient();
            EndpointAddress MyEndpointAddress = new EndpointAddress("http://localhost/s//DesktopModules/IWebCF/CoreService.svc/IWebTabManager");
            client.Endpoint.Address = MyEndpointAddress;
            client.GetTabNamesOnPortalCompleted += new EventHandler<GetTabNamesOnPortalCompletedEventArgs>(client_GetTabNamesOnPortalCompleted);


            IWebAuthenticationHeader header = new IWebAuthenticationHeader();
            header.Encrypted = "False";
            header.PortalID = intPortalID;
            header.Password = strPassword;
            header.PortalID = intPortalID;
            header.UserID = intUserID;
            header.Username = "host";
            header.WebPageCall = "False";        

            proxy.getfsiDBAsync(header);            


        }



        void client_GetTabNamesOnPortalCompleted(object sender, GetTabNamesOnPortalCompletedEventArgs e)
        {
            btnButton.Content = e.Result[0].ToString();
        }


==== End =====

Thanks for your help.
Coordinator
Jan 5, 2009 at 10:04 PM
I am a complete Silverlight Novice, so maybe Michael can chime in here, but I think  you need to switch the binding to basicHttpBinding to be use any WCF code with Silverlight... but like I said I have not tried any Silverlight to WCF stuff. So I am not sure.
Coordinator
Jan 5, 2009 at 11:40 PM
Yes for Silverlight you can only use "basicHttpBinding"
Jan 11, 2009 at 12:52 PM
"It's always something." Rosanna Dana, Saturday Night Live.

Over HTTP, my DNN 4.8.4 site successfully runs IWebCF and the IWebTabManagerMethods.vb service.  Your "basicHttpBinding" advice did it!

Here are my learning points:

1) Silverlight2 WCF only supports basicHttpBinding

2) Webservices: video #  46 - 48

http://silverlight.net/learn/videocat.aspx?cat=2#HDI2WebServices

3) Cross Domain Policy file is required.  Site runs under localhost but not over the Internet:

http://silverlight.net/Learn/videocat.aspx?cat=10

4) HTTP tracing tool.  Web Development Helper runs in IE.

http://projects.nikhilk.net/WebDevHelper/

------------

My next hurdle is running over HTTPS.

 In point # 2 above, Cross Policy file, the video states the client and website must be configured for HTTPS.  In the video, the web.config file:

   <basicHttpBinding>
     <binding name="basicHttpBinding">
      <security mode="Transport"></security>     <**** For HTTPS
     </binding>
   </basicHttpBinding>

On the DNN site server, how do I change App_Code/ServiceMethods/IWebTabManagerMethods.vb and web.config?

Thx