.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Throwinfg Exception from a faulted Message.

Posted By:      Posted Date: September 06, 2010    Points: 0   Category :WCF
Hi I havetransparent proxy that recieves a message from the service. I have to test what happens when the service throws any exception. When I generate the proxy from the "Add Service Reference" from visual studio, it works ok. If I throw a InvalidOperationException on the service it reaches the client with the traditional FaultException. But with my manyally created proxy, it only recieves the faulted messate ( the IsFault attribute is true ) but it does not throw the exception. Here are the exmamples: Host: Contract:   [ServiceContract(Namespace = "http://my.namespace.com")] public interface ICalculadora { [OperationContract] int LancaException(string codigo); }   Service:   public class Service : ICalculadora { public int LancaException(string codigo) { if (codigo == "exception") { throw new InvalidOperationException("Operação ilegal", new DivideByZeroException("Divisão por zero")); } else if (codigo == "numero") { return 32; } else if (codigo == "fault") { InvalidOperationException invEx = new InvalidOperationException("Operacao inválida dentro da faulta"); //throw new FaultException<InvalidOperation

View Complete Post

More Related Resource Links

The formatter threw an exception while trying to deserialize the message

Hi I got this error when programming in C# 2008 The formatter threw an exception when trying to deserialize the message: Error while trying to deserialize parameter http://tempuri.org/:GetListSitesResponse. The InnerException message was' Error on line 1, position 314. The item 'http://tempuri.org/:anyType' contains data data contract 'http://tempuri.org/:Site'. The deserializer has no knowledge of any type that is assigned to this contract. Add the type corresponding to 'Site' to the list of known types (eg, using the attribute KnownTypeAttribute or adding it to the list of known types passed to DataContractSerializer). '. See InnerException for more information. This happen in my button_click event (this is a project on C# 2008 express windows form application) private void button1_Click(object sender, EventArgs e)         {             SiteDevelopmentReference.Service1SoapClient sd = new SiteDevelopmentReference.Service1SoapClient();             listBox1.Items.AddRange(sd.GetListSites().ToArray());                            } I have a service reference from another project

ws-addressing 'Action' required message part not signed exception

I have a WCF client calling a Java-based service. The service vendor is supporting WCF clients. The WCF client binding uses authenticationMode="MutualCertificate", messageVersion="Soap11WSAddressing10" and the message is signed and encrypted (SignBeforeEncrypt). WCF, in this case, is automatically signing all the ws-addressing ( <Action>, <MessageID> and <To> ) headers. The message gets to the service and comes back with what appears to be valid encrypted data in the response BUT the client is throwing a "The 'Action', 'http://www.w3.org/2005/08/addressing' required message part was not signed" exception (mscorlib). Questions: Is there a way to NOT sign the ws-addressing headers in the request message while still using both signing and encryption (X.509 certs)? If the client DOES sign the ws-addressing headers in the request, is there a way to configure WCF to accept UNsigned ws-addressing headers in the response? If the answer is NO on both questions, I guess I will have to ask the service vendor to sign the ws-addressing headers in the response. Thanks.

Help!!! WCF:: The formatter threw an exception while trying to deserialize the message

I have[ServiceContract]    public interface IBusiness    {        [OperationContract]        [WebInvoke(Method = "POST", BodyStyle = WebMessageBodyStyle.Wrapped, ResponseFormat = WebMessageFormat.Json)]        bool UpdateLanguage(int languageId, string name, string code);    }public class Business:IBusiness    {        public bool UpdateLanguage(int languageId, string name, string code)        {           //update to database        }    }Add client:$.ajax({ type: "POST", url: "/Services/Business.svc/UpdateLanguage", data: "{'languageId':'" + languageId + "', " + "'name':'" + name + "'," + "'code':'" + code + "'}", contentType: "application/json; charset=utf-8", dataType: "json", processdata: true, success: function (response) { //rebind data here!

WCF Exception "Message security verification failed" only with header!

Hi, I've got a WCF service doing Username authentication. I authenticate with AD and authorize using AzMan on AD. I'm hosting the service in IIS 6 and its running in an app pool that runs in a domain account that has read rights on the AD. I have a custom header that goes both ways. Everything works well until I assign the custom header to return. If I never assign the custom header to return everything is ok but if I do assign the custom header to return I get the error:- Message security verification failed.Duplicate attribute found. Both 'u:Id' and 'u:Id' are from the namespace 'http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd'. Line 1, position 520. I've got service level message tracing and I can see the secure conversation stuff happening and the messages going across the interface.   If anyone has any ideas I'd be most appreciative.   Thanks,   Andy

ASP.net UPS void wsdl error message 'exception has been raised as a result of client data'


exception has been raised as a result of client data. at System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall) at System.Web.Services.Protocols.SoapHttpClientProtocol

Void shipment erro message; I can't determine how to resolve error.  at ***

The following is the code for ups void shipment wsdl...

protected void wsdlRate()


RateWSs.RateRequest rateReq = new RateRequest();RateWSs.UPSSecurity rateSecurity = new RateWSs.UPSSecurity(); RateWSs.UPSSecurityServiceAccessToken rateToken = new RateWSs.UPSSecurityServiceAccessToken

throw exception message giving internal server error on live site


using vb.net/asp.net 2005

when a user enters a bad email I am doing a check on this and throwing an exception message as follows, this works fine on the test site but for some reason the same code on the live site gives a "internal server error" (http code 500).  The code below:

            If isThisEmailValid(strEmailThatTheUserEntered) Then
		'do something


                Throw New Exception("You entered a bad email address.")

            End If

not certain why this is happening, I assume that it's some server or config difference between the test and live sites.  has anyone seen this before?  For a quick fix i'm registering javascript alert and showing the same text so it works but I would like to figure out why the code above is not working.

as always, thanks for your feedback


problems when sending mail from mail program - receive exception Message MSCORLIB


When sending out email through Live mailer pro I get now the following message for each email that I want to send:


Error Message

String was not recognized as a valid DateTime.


Stack Trace

   at System.DateTimeParse.Parse(String s, DateTimeFormatInfo dtfi, DateTimeStyles styles)
   at System.DateTime.Parse(String s, IFormatProvider provider)
   at System.Convert.ToDateTime(String value)
   at Mailer.TrackProxy.get_IsTrackOK()


Can someone tell me what I have to do to solve this problem?

I use windows server 2k



MSMQ system.messaging.message.body unauthorizedaccessexception: Access is denied (exception fro HRRE



I am facing this error long back.. Please help me in this regards...

I have my .Net 2.0 Windows service to read the Priavate non transactions message queues and process into Sql Server 2005 database.....

I have used threading concept too.. i have multiple queues to be read on regular basis...

Getting below error exactly when reading the message body

system.messaging.message mInput ;

timespan tsInput = 1000;

mInput = mqInput.Receive(tsInput);

      ActiveXMessageFormatter axFormatter= new ActiveXMessageFormatter();
      pubqloader.DMPMessage DMPmsg = new PubQLoader.DMPMessage();
      object temp = new Object();
      temp = mInput.Body; --- here getting the error 

UnauthorizedAccessException Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))   

Stack Trace1: when mInput.Body is used

System.Messaging.Interop.NativeMethods.OleLoadFromStream(IStream stream, Guid& iid)
   at System.Messaging.ActiveXMessageFormatter.Read(Message message)
   at System.Messaging.Message.get_Body()

Exception message: The SiteMapProvider 'SPAdministrationQuickLaunchProvider' cannot be found.


Help, how do I troubleshoot this issue that occurs when I try to go to Central Administration?


Exception information:
Exception type: HttpException
Exception message: The SiteMapProvider 'SPAdministrationQuickLaunchProvider' cannot be found.


Request information:

Request URL: http://sfvtestdev02:9810/_admin/sssvc/ManageSSSvcApplication.aspx?AppId=952b9f2dAn unhandled exception has occurred.D08d9An unhandled exception has occurred.D4bb2An unhandled exception has occurred.Daf10An unhandled exception has occurred.Dc2a0a6698e9e

Request path: /_admin/sssvc/ManageSSSvcApplication.aspx

User host address:
User: CORP\xxxxx
Is authenticated: True
Authentication Type: NTLM
Thread account name: TEST\spfarmsvc

Leland Usher SharePoint Developer/Administrator

UpdateListItems & "The formatter threw an exception while trying to deserialize the message"


I'm trying to update a column in a SharePoint List with the following code. The column is updated, but an error is thrown trying to deserialize the SOAP response message. I've not been able to trap the raw SOAP response message to see what's being passed back...so I don't know what else to do to debug this issue.

        static public void updateMigrationFlag(string targetList, string projectID)


            string sQuery = @"<Batch OnError='Continue' ListVersion='1' ViewName=''>"

                            + @"<Method ID='1' Cmd='Update'>"

                            + @"<Field Name='ID'>" + projectID + "</Field>"

                            + @"<Field Name='hMigrationStatus'>True</Field>"

                            + @"</Method>"


Getting "Exception from HRESULT: 0x80131904" error message



I intermitently received the "Exception from HRESULT: 0x80131904" error message on my Sharepoint site.  For example, it pops up when I try to add a folder in a document library.

What could be my problem?



an error occured while rendering navigation for requested url:/. Exception message: the given key wa

I have added a new server to my MOSS 2007 farm and completed the SharePoint configuration wizard. To test I have stopped the WP3 service on the first server (SPS01) and started the service on the newly added server (SPS02). When I hit the site the global navigation and the left navigation show error: an error occured while rendering navigation for requested url:/. Exception message: the given key was not present in the dictionary. If I stop the WP3 service on SPS02 and start it gain on SPS01 and hit the site again it works fine. The SPS02 is Windows Server 2008 R2 and SPS01 is Windows Server 2003. Does anyone know what configuration adjustment I need to make on the 2008 R2 server to render my navigation when someone hits the site through that server?

SQL Server try-catch inner exception message conundrum



The following SQL statement below is a good example of some SQL that throws an exception with nested details. It seems in the catch part of the statement I can only get outer exception details Could not create constraint. See previous errors (not very useful!). What I want to get is the inner exception message:

Introducing FOREIGN KEY constraint 'FK_TWO' on table 'TABLE2' may cause cycles or multiple cascade paths. Specify ON DELETE NO ACTION or ON UPDATE NO ACTION, or modify other FOREIGN KEY constraints (you can get this message by running the code without try-catch).

In the Catch block, how can this be achieved in T-SQL? If not is this something that can be fixed in SQL going forward, where can I send this request?


      CHAR(50) NOT NULL);



An Exception occured while enqueueing a message in the target queue. Error 15404....


2010-06-30 11:40:01.94 spid18s     An exception occurred while enqueueing a message in the target queue. Error: 15404, State: 19. Could not obtain information about Windows NT group/user 'DOMAIN\SomeAdminAccount', error code 0x5.
2010-06-30 11:40:05.93 spid18s     Error: 28005, Severity: 16, State: 2.

The above error keeps repeating every 5 seconds in my error log. (C:\Program Files\M$ SQL Server\MSSQL10.SERVERINSTANCE\MSSQL\Log\ERRORLOG.

It doesn't break anything but its filling up my error log. What gives with the above code? I've tried everything - i've addeed the user object to Pre-Windows 2000 Active Directory, i gave it Read Group Permissions and Read Group PermissionsSAM, i even gave it super high level acces in the administration groups. But still, no luck... Whats up with this admin account?

Searchin the web has given no good results.


Gmail internal chat like message box

This article provides you with the multi-functional message box window through which the usability of the web-site or any web application increases.

.Configurable MessageBox window with AJAX Support
.can set maximum number of message boxes to be visible
.can define the auto reload time, for single message, for all messages or no reload
.can create messages through a single function call
.can define auto hide time for each messages


Every self-respected programmer should include exception handling techniques. Sometimes your application will generate an error. Regardless of who was responsible for this error, the programmer or the user, it is up to the first to include the necessary exception handling techniques to keep his/her program from crashing. The .Net environment provides useful techniques for avoiding disastrous errors such as try-catch statements and user-defined exceptions.

Global Exception Handling with ASP.NET

After your global exception handler has done its work, you'll want to redirect the users of your website to a friendly page that tells them that something has gone wrong, and then provide them with customer support information as well as a link back to your web application's home page.
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend