use clog by a silverlight client - gets (404) Not Found

Jun 19, 2008 at 3:36 PM
Daniel hi,

I try to use Clog by a Silverlight client.
I created a silverlight application + webApp similar to the example offered in 1_1_3.

When i run the client and attempt to submit a log request, i get the following exception:

System.ServiceModel.ProtocolException was unhandled by user code
  Message="The remote server returned an unexpected response: (404) Not Found."
  StackTrace:
       at System.ServiceModel.AsyncResult.End[TAsyncResult](IAsyncResult result)
       at System.ServiceModel.Channels.ServiceChannel.SendAsyncResult.End(SendAsyncResult result)
       at System.ServiceModel.Channels.ServiceChannel.EndCall(String action, Object[] outs, IAsyncResult result)
       at System.ServiceModel.ClientBase`1.ChannelBase`1.EndInvoke(String methodName, Object[] args, IAsyncResult result)
       at Orpius.Logging.ClientLogging.ClogServiceClient.ClogServiceClientChannel.EndGetConfiguration(IAsyncResult result)
       at Orpius.Logging.ClientLogging.ClogServiceClient.Orpius.Logging.ClientLogging.IClogService.EndGetConfiguration(IAsyncResult result)
       at Orpius.Logging.ClientLogging.ClogServiceClient.OnEndGetConfiguration(IAsyncResult result)
       at System.ServiceModel.ClientBase`1.OnAsyncCallCompleted(IAsyncResult result)
  InnerException:


Server side configuration is:
in Web.config:

     <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net"/>
    <section name="ClientLogging" type="Orpius.Logging.Configuration.ClientLoggingConfigSection"/>


    <!-- Clog configuration. [DV] -->
    <ClientLogging defaultProvider="Log4NetProvider">
        <providers>
            <clear/>
            <add name="Log4NetProvider" type="Orpius.Logging.LogStrategyProvider, Orpius.Logging" LogStrategy="Orpius.Logging.LogStrategies.Log4NetStrategy, Orpius.Logging.Log4NetLogStrategy"/>
            <add name="CustomProvider" type="Orpius.Logging.LogStrategyProvider, Orpius.Logging" LogStrategy="ExampleWebsite.SimpleLogStrategy, MyClog_Web"/>
        </providers>
        <filters>
            <add name="IPAddressRange" type="Orpius.Logging.Filters.IPAddressRangeFilter, Orpius.Logging" begin="127.0.0.0" end="127.0.0.10"/>
            <add name="RoleMembership" type="Orpius.Logging.Filters.RoleMembershipFilter, Orpius.Logging" roles="Developer, Administrator"/>
        </filters>
    </ClientLogging>
 
   <!-- log4net [DV] -->
    <log4net debug="true">
        <appender name="LogFileAppender" type="log4net.Appender.FileAppender">
          <param name="File" value="Logs\\Log4Net.log"/>
          <layout type="log4net.Layout.PatternLayout">
            <param name="ConversionPattern" value="%d [%t] %-5p %m%n"/>
          </layout>
        </appender>
        <root>
            <level value="ALL"/>
            <appender-ref ref="LogFileAppender"/>
        </root>
        <!-- Clog requires url in logger names to be lower case. When using Clog on localhost, paths are relative. -->
        <logger name="MyClog_Web.Page,/default.aspx">
            <level value="INFO"/>
        </logger>
        <logger name="MyClog_Web.Page,http://www.orpius.com/innerpath/default.aspx">
            <level value="INFO"/>
        </logger>
    </log4net>

    <system.serviceModel>
        <behaviors>
            <serviceBehaviors>
                <behavior name="Orpius.Logging.ClogServiceBehavior">
                    <serviceMetadata httpGetEnabled="true"/>
                    <serviceDebug includeExceptionDetailInFaults="true"
                        httpHelpPageEnabled="true"/>
                </behavior>
            </serviceBehaviors>
        </behaviors>
        <services>
            <service behaviorConfiguration="Orpius.Logging.ClogServiceBehavior"
                name="Orpius.Logging.ClogService">
                <endpoint address="" binding="wsHttpBinding"
                    contract="Orpius.Logging.IClogService"/>
                <endpoint address="mex" binding="mexHttpBinding"
                    contract="IMetadataExchange"/>
            </service>
        </services>
    </system.serviceModel>

in ClogService.svc:
<%@ ServiceHost Language="C#" Debug="true" Service="Orpius.Logging.ClogService" %>


Client side configuration:
in ServiceReferences.ClientConfig:
<configuration>
    <system.serviceModel>
        <bindings>
            <basicHttpBinding>
                <binding name="BasicHttpBinding_IClogService" maxBufferSize="65536"
                    maxReceivedMessageSize="65536">
                    <security mode="None" />
                </binding>
            </basicHttpBinding>
        </bindings>
        <client>
            <endpoint address="http://localhost:4755/ClogService.svc" binding="basicHttpBinding"
                bindingConfiguration="BasicHttpBinding_IClogService" contract="Orpius.Logging.ClientLogging.IClogService"
                name="BasicHttpBinding_IClogService" />
        </client>
    </system.serviceModel>
</configuration>


Thanks so much
Eran Shallev
Coordinator
Jun 20, 2008 at 8:40 AM
Edited Jun 20, 2008 at 10:18 AM
Eran,

Ensure that you have configured your web application to use a specific port. This is done in the project properties / Web tab.

Have you configured the endpoint address for the web service correctly?
http://localhost:Port#/ClogService.svc

Are you able to navigate to http://localhost:4755/ClogService.svc while debugging?
In the ExampleSilverlightProject project there is a file called ServiceReferences.ClientConfig. Ensure that the url specified in the web.config and ServiceReferences.ClientConfig is correct.

Cheers,
Daniel
Jun 23, 2008 at 8:39 AM
Daniel,
I finally got it right, and can log my silverlight application.

Thanks
Eran