Search Results

Search found 152 results on 7 pages for 'rory hart'.

Page 7/7 | < Previous Page | 3 4 5 6 7 

  • IErrorHandler doesn't seem to be handling my errors in WCF .. any ideas?

    - by John Nicholas
    Have been readign around on IErrorHandler and want to go the config route. so, I have read the following in an attempt to implement it. MSDN Keyvan Nayyeri blog about the type defintion Rory Primrose Blog I have got it to compile and from the various errors i have fixed it seems like WCF is actually loading the error handler. My problem is that the exception that i am throwing to handle in the error handler doesn;t get the exception passed to it. My service implementation simply calls a method on another class that throws ArgumentOutOfRangeException - however this exception never gets handled by the handler. My web.config <system.serviceModel> <bindings> <basicHttpBinding> <binding name="basic"> <security mode="None" /> </binding> </basicHttpBinding> </bindings> <extensions> <behaviorExtensions> <add name="customHttpBehavior" type="ErrorHandlerTest.ErrorHandlerElement, ErrorHandlerTest, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" /> </behaviorExtensions> </extensions> <behaviors> <serviceBehaviors> <behavior name="exceptionHandlerBehaviour"> <serviceMetadata httpGetEnabled="true"/> <!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information --> <serviceDebug includeExceptionDetailInFaults="true"/> <customHttpBehavior /> </behavior> </serviceBehaviors> </behaviors> <services> <service behaviorConfiguration="exceptionHandlerBehaviour" name="ErrorHandlerTest.Service1"> <endpoint binding="basicHttpBinding" bindingConfiguration="basic" contract="ErrorHandlerTest.IService1" /> </service> </services> Service Contract [ServiceContract] public interface IService1 { [OperationContract] [FaultContract(typeof(GeneralInternalFault))] string GetData(int value); } The ErrorHandler class public class ErrorHandler : IErrorHandler , IServiceBehavior { public bool HandleError(Exception error) { Console.WriteLine("caught exception {0}:",error.Message ); return true; } public void ProvideFault(Exception error, MessageVersion version, ref Message fault) { if (fault!=null ) { if (error is ArgumentOutOfRangeException ) { var fe = new FaultException<GeneralInternalFault>(new GeneralInternalFault("general internal fault.")); MessageFault mf = fe.CreateMessageFault(); fault = Message.CreateMessage(version, mf, fe.Action); } else { var fe = new FaultException<GeneralInternalFault>(new GeneralInternalFault(" the other general internal fault.")); MessageFault mf = fe.CreateMessageFault(); fault = Message.CreateMessage(version, mf, fe.Action); } } } public void AddBindingParameters(ServiceDescription serviceDescription, ServiceHostBase serviceHostBase, System.Collections.ObjectModel.Collection<ServiceEndpoint> endpoints, BindingParameterCollection bindingParameters) { } public void ApplyDispatchBehavior(ServiceDescription serviceDescription, ServiceHostBase serviceHostBase) { IErrorHandler errorHandler = new ErrorHandler(); foreach (ChannelDispatcherBase channelDispatcherBase in serviceHostBase.ChannelDispatchers) { ChannelDispatcher channelDispatcher = channelDispatcherBase as ChannelDispatcher; if (channelDispatcher != null) { channelDispatcher.ErrorHandlers.Add(errorHandler); } } } public void Validate(ServiceDescription serviceDescription, ServiceHostBase serviceHostBase) { } } And the Behaviour Extension Element public class ErrorHandlerElement : BehaviorExtensionElement { protected override object CreateBehavior() { return new ErrorHandler(); } public override Type BehaviorType { get { return typeof(ErrorHandler); } } }

    Read the article

  • How to find specific value of the node in xml file

    - by user2735149
    I am making windows phone 8 app based the webservices. This is my xml code: - <response> <timestamp>2013-10-31T08:30:56Z</timestamp> <resultsOffset>0</resultsOffset> <status>success</status> <resultsLimit>8</resultsLimit> <resultsCount>38</resultsCount> - <headlines> - <headlinesItem> <headline>City edge past Toon</headline> <keywords /> <lastModified>2013-10-30T23:45:22Z</lastModified> <audio /> <premium>false</premium> + <links> - <api> - <news> <href>http://api.espn.com/v1/sports/news/1600444?region=GB</href> </news> </api> - <web> <href>http://espnfc.com/uk/en/report/381799/city-edge-toon?ex_cid=espnapi_public</href> </web> - <mobile> <href>http://m.espn.go.com/soccer/gamecast?gameId=381799&lang=EN&ex_cid=espnapi_public</href> </mobile> </links> <type>snReport</type> <related /> <id>1600444</id> <story>Alvardo Negredo and Edin Dzeko struck in extra-time to book Manchester City's place in the last eight of the Capital One Cup, while Costel Pantilimon kept a clean sheet in the 2-0 win to keep the pressure on Joe Hart. </story> <linkText>Newcastle 0-2 Man City</linkText> - <images> - <imagesItem> <height>360</height> <alt>Man City celebrate after Edin Dzeko scored their second extra-time goal at Newcastle.</alt> <width>640</width> <name>Man City celeb Edin Dzeko goal v nufc 20131030 [640x360]</name> <caption>Man City celebrate after Edin Dzeko scored their second extra-time goal at Newcastle.</caption> <type>inline</type> <url>http://espnfc.com/design05/images/2013/1030/mancitycelebedindzekogoalvnufc20131030_640x360.jpg</url> </imagesItem> </images> Code behind: myData = XDocument.Parse(e.Result, LoadOptions.None); var data = myData.Descendants("headlines").FirstOrDefault(); var data1 = from query in myData.Descendants("headlinesItem") select new UpdataNews { News = (string)query.Element("headline").Value, Desc = (string)query.Element("description"), Newsurl = (string)query.Element("links").Element("mobile").Element("href"), Imageurl=(string)query.Element("images").Element("imagesItem").Element("url").Value, }; lstShow.ItemsSource = data1; I am trying to get value from xml tags and assign them to News,Desc, etc. Everything works fine except Imageurl, it shows NullException. I tried same method for Imageurl, i dont know whats going wrong. Help..

    Read the article

< Previous Page | 3 4 5 6 7