Silverlight consuming WCF error.

Discussion in 'Silverlight' started by mod2tecno, Jun 26, 2012.

  1. Hi All, i've some problem with my application.

    I've a silverlight 4.0 application consuming a WCF service for some issue.
    On my pc, with VS2010 i've no problem.

    I created a Web Directory called ModDiagnostic.WCF and the service is accessible
    http://mod2tecno.com/ModDiagnostic.WCF/Scheduler_Service.svc

    When i try to call it by silverlight app i've error in attachment.

    This is web.config of WCF
    HTML:
    <?xml version="1.0"?>
    <configuration>
      <system.web>
        <compilation debug="true" targetFramework="4.0">
          <assemblies>
            <add assembly="System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
          </assemblies>
        </compilation>
      </system.web>
    
      <system.serviceModel>
        <bindings>
          <basicHttpBinding>
            <binding name="MyBasicHttpBinding">
              <security mode="None">
                <transport clientCredentialType="None" />
              </security>
            </binding>
          </basicHttpBinding>
          <wsHttpBinding>
            <binding name="CustomBinding">
              <security mode="Transport">
                <message establishSecurityContext="false"/>
                <transport clientCredentialType="None"/>
              </security>
            </binding>
          </wsHttpBinding>
        </bindings>
        <services>
          <service behaviorConfiguration="Mod2ServiceBehavior" name="ModDiagnostic.WCF.Scheduler_Service">
            <endpoint address="" binding="basicHttpBinding" name="basicHttpBindingSC" contract="ModDiagnostic.WCF.IScheduler_Service" 
                      bindingConfiguration="MyBasicHttpBinding" />
            <endpoint address="mex" binding="mexHttpBinding" name="mexHttpBinding" contract="IMetadataExchange" />
          </service>
          <service behaviorConfiguration="Mod2ServiceBehavior" name="ModDiagnostic.WCF.DataReduction_Service">
            <endpoint address="" binding="basicHttpBinding" name="basicHttpBindingDR" contract="ModDiagnostic.WCF.IDataReduction_Service" 
                      bindingConfiguration="MyBasicHttpBinding" />
            <endpoint address="mex" binding="mexHttpBinding" name="mexHttpBinding" contract="IMetadataExchange" />
          </service>
        </services>
        <behaviors>
          <serviceBehaviors>
            <behavior name="Mod2ServiceBehavior">
              <serviceMetadata httpGetEnabled="true" />
              <dataContractSerializer maxItemsInObjectGraph="2147483646" />
            </behavior>
          </serviceBehaviors>
        </behaviors>
     
        <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
      </system.serviceModel>
      <system.webServer>
        <modules runAllManagedModulesForAllRequests="true" />
      </system.webServer>
    
      <connectionStrings>
        <add name="DBMod2_ver2Entities" connectionString="****'" providerName="System.Data.EntityClient" />
      </connectionStrings>
    
    </configuration>
    
    

    This is ServiceReferences.ClientConfig

    HTML:
    <configuration>
      <behaviors>
        <endpointBehaviors>
          <behavior name="debuggingBehaviour">
            <dataContractSerializer maxItemsInObjectGraph="2147483646" />
          </behavior>
        </endpointBehaviors>
      </behaviors>
      <system.serviceModel>
            <bindings>
                  <basicHttpBinding>
                        <binding name="basicHttpBinding" closeTimeout="00:02:00" maxBufferSize="500000000"
                              maxReceivedMessageSize="500000000" >
                          <security mode="Transport" ></security>
                        </binding>
                        <binding name="basicHttpBindingDR" closeTimeout="00:02:00" maxBufferSize="500000000"
                              maxReceivedMessageSize="500000000">
                            <security mode="Transport" ></security>
                        </binding>
                        <binding name="basicHttpBinding1" maxBufferSize="2147483647"
                              maxReceivedMessageSize="2147483647">
                              <security mode="None" />
                        </binding>
                  </basicHttpBinding>
            </bindings>
            <client>
                  <endpoint address="http://localhost:5875/Scheduler_Service.svc"
                        binding="basicHttpBinding" bindingConfiguration="basicHttpBinding"
                        contract="Scheduler_Service.IScheduler_Service" name="basicHttpBinding" />
                  <endpoint address="http://localhost:5875/DataReduction_Service.svc"
                        binding="basicHttpBinding" bindingConfiguration="basicHttpBindingDR"
                        contract="DataReduction_Service.IDataReduction_Service"
                        name="basicHttpBindingDR" />
            </client>
        </system.serviceModel>
    </configuration>
    This is code for calling service
    Code:
    string WCFUri = string.Empty;
    if (App.Current.Resources["WCF"] != null)
       WCFUri = App.Current.Resources["WCF"].ToString();
                                   
    if (WCFUri != string.Empty)
    {
      Uri servUri = new Uri(WCFUri + "/Scheduler_Service.svc", UriKind.RelativeOrAbsolute);
      EndpointAddress servAddr = new EndpointAddress(servUri);
      Scheduler_ServiceClient proxy = new      Scheduler_ServiceClient("basicHttpBindingSC", servAddr);
      proxy.MergerCompleted += new EventHandler<MergerCompletedEventArgs>(proxy_MergerCompleted);
      proxy.MergerAsync(_selSession.Session_ID, _selSession.GOT_ID);
      proxy.CloseAsync();
    }

    Please, give me some helps.
    Thanks in advance

    Antonio
     

    Attached Files:

Share This Page