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


Top 5 Contributors of the Month
david stephan
Post New Web Links

Enum in WCF is throwing exception

Posted By:      Posted Date: September 10, 2010    Points: 0   Category :WCF
 
wcf service method is returning a datacontract that contains an enum .The following error is thrown in the clientSystem.ServiceModel.CommunicationException was caught  Message="An error occurred while receiving the HTTP response to http://localhost:8731/Design_Time_Addresses/WCFTest3/Service1/. This could be due to the service endpoint binding not using the HTTP protocol. This could also be due to an HTTP request context being aborted by the server (possibly due to the service shutting down). See server logs for more details."  Source="mscorlib"  StackTrace:    Server stack trace:        at System.ServiceModel.Channels.HttpChannelUtilities.ProcessGetResponseWebException(WebException webException, HttpWebRequest request, HttpAbortReason abortReason)       at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)       at System.ServiceModel.Channels.RequestChannel.Request(Message message, TimeSpan timeout)       at System.ServiceModel.Channels.ClientReliableChannelBinder`1.RequestClientReliableChannelBinder`1.OnRequest(TRequestChannel channel, Message message, TimeSpan timeout, MaskingMode maskingMode)       at System.ServiceModel.Channels.ClientReliableChannelBinder`1.Request(Message message, TimeSpan timeout, MaskingMode maskingMode)       at System.ServiceModel.Channels.ClientReliableChannelBind


View Complete Post


More Related Resource Links

Error Handling: Throwing Custom Exception Types from a Managed COM+ Server Application

  

Exception handling semantics in .NET are based on type, so you can create custom exceptions that have their own properties and methods. In .NET, exceptions are first-class citizens, and since they're the built-in error handling mechanism, all .NET-compliant languages must support exceptions. In addition, COM+ services are available to .NET code as Enterprise Services, so you can leverage exceptions in your Enterprise Services design.In this article the author describes custom exceptions, throwing exceptions across COM interop boundaries, and working with Enterprise Services.

Bob DeRemer

MSDN Magazine March 2004


PathGradientBrush throwing OutOfMemory exception

  
Hi, I don't know why I'm getting an OutOfMemoryException whil trying to create a PathGradientBrush. Here is my code:   Code Block GraphicsPath gp; PathGradientBrush pgb; Rectangle rec;   rec = new Rectangle(new Point(35, 35), new Size(60, 60));   Point[] pontos = new Point[6]; pontos[0] = new Point(rec.Left, rec.Bottom); pontos[1] = new Point(rec.Left, rec.Top - 2); pontos[2] = new Point(rec.Left + 2, rec.Top); pontos[3] = new Point(rec.Right - 2, rec.Top); pontos[4] = new Point(rec.Right, rec.Top + 2); pontos[5] = new Point(rec.Right, rec.Bottom);   byte[] pontosTipo = new byte[6]; pontosTipo[0] = (byte)PathPointType.Start; pontosTipo[1] = (byte)PathPointType.Line; pontosTipo[2] = (byte)PathPointType.Bezier; pontosTipo[3] = (byte)PathPointType.Line; pontosTipo[4] = (byte)PathPointType.Bezier; pontosTipo[5] = (byte)PathPointType.Line;   gp = new GraphicsPath(pontos, pontosTipo); pgb = new PathGradientBrush(gp); // OutOfMemoryException pgb.SurroundColors = new Color[] { Color.White, Color.Blue };     This code was running in the Paint event, and then I passed to the constructor. Still, the out of memory exception keeps throwing. I have no Idea why this is happening. It is an empty form. Any ideas on why this is happening?   Thanks for any help, Regards, Fábio

WCF Service stops after throwing a unhandled exception :no user is logged on.

  
Hi All,       I have written a WCF service which is hosted as a Managed windows service. I consume this service in a web application. The service is built using a httpBasicBinding and security Mode ="none". I'm now getting the following exception, after which the service stops  "An unhandled exception ('System.ComponentModel.Win32Exception') occurred in CMMonitorService.exe [1812]. Just-In-Time debugging this exception failed with the following error: Debugger could not be started because no user is logged on." I had tried changing the security mode to Transport/Message. with windows credential then I get a access to the path denied error. Can anyone provide hint on what am I missing and what would be the appropriate security mode and client credential to use along with basichttpBinding?

WCF: Problem throwing FaultException after touching Exception.Data collection

  

 

My client code receives a CommunicationException if my server code touches the Exception.Data collection.  If my server code avoids the Exception.Data collection, then my client code works (i.e. it receives my custom exception as expected). 

 

I have reduced this problem down to two simple examples (see below)..one that works (A), one that does not (B).  The only difference between the two examples is that in example B, the code looks at the Exception.Data.Count property.

 

Why would touching the Exception.Data collection cause my client code to receive the CommunicationException? 

Is there any way to avoid this?

 

Thank you in advance for an consideration you may give to this question. 

 

A: Working Example: Client Receives CustomException
 try
 {
  DoSomething();
  throw new CustomException("This is a custom exception.");
 }           
 catch (CustomException ex)
 {  
  throw new FaultException<CustomException>(ex, new FaultReason(ex.Message), new FaultCode("Receiver"));
 }

         

B: Non-working Example: Clien

WPF textbox throwing OutOfMemory exception...

  

Hello,

I am using a texbox in my appication to capture the log. But when I reach a certain point, it throws a system.outofmemory exception and crashes the app. How can I handle such a situation. I really need to show all the contents to the user as I cannot remove older contents. Is it possible that I save some of the older lines to a temp file? If yes, how do I do it and also at the end I should be able to hit a Save Button to Save all the contents to a text file at the specified location. So if I am transfering contents of the textbox to a temp file then how do I combine the whole log (from the temp file as well as the textbox) and save it to this new file? Also is it possible to remove the temp file everytime the OS is restarted?? 

Any help will be greatly appreciated.

Thanks!  


issues with Microsoft.Office.Interop.Excel in asp.net throwing Exception from HRESULT: 0x800A03EC

  

i m using Microsoft.Office.Interop.Excel in asp.net for Excel file as anEmail attachment .

i get the data and write to Excel but when i try to save like:

oWB.SaveAs(strCurrentDir +strFile, Microsoft.Office.Interop.Excel.

 

XlFileFormat.xlWorkbookNormal, null,

WorkflowRuntime.CreateWorkflow => Throwing Exception

  
Hi,
 I am getting following exception from WorkfolwRuntime ..........
System.ArgumentException: An item with the same key has already been added.
   at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource)
   at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
   at System.Workflow.Runtime.TrackingListenerFactory.WorkflowExecutorInitializing(Object sender, WorkflowExecutorInitializingEventArgs e)
   at System.EventHandler`1.Invoke(Object sender, TEventArgs e)
   at System.Workflow.Runtime.WorkflowRuntime.WorkflowExecutorCreated(WorkflowExecutor workflowExecutor, Boolean loaded)
   at System.Workflow.Runtime.WorkflowExecutor.RegisterWithRuntime(WorkflowRuntime workflowRuntime)
   at System.Workflow.Runtime.WorkflowRuntime.RegisterExecutor(Boolean isActivation, WorkflowExecutor executor)
   at System.Workflow.Runtime.WorkflowRuntime.Load(Guid key, CreationContext context, WorkflowInstance workflowInstance)
   at System.Workflow.Runtime.WorkflowRuntime.GetWorkflowExecutor(Guid instanceId, CreationContext context)
   at System.Workflow.Runtime.WorkflowRuntime.Intern

EXCEPTION HANDLING IN C#

  
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.

SQL Server 2005 Try and Catch Exception Handling

  
I'm pretty excited to see that there is some real error handling for T-SQL code in SQL Server 2005. It's pretty painful to have your wonderfully architected .NET solution tainted by less-than-VBScript error handling for stored procedures in the database. The big difference being the addition of TRY..CATCH blocks. Let's take a look:

How to cast integer values as an array of enum values?

  

Hello all!

I'm working with VS2010 Beta2, ASP.NET and Dynamic Data. I'm using VB but will certainly be happy to receive a C# example if necessary. Laughing

I used a few of Steve's examples (Writing Attributes and Extension Methods for Dynamic Data and Dynamic Data - Hiding Columns in selected PageTemplates) to create a custom property attribute to be applied to a dynamic data column and want it to accept an array of enum values (each value will represent a dynamic data page template where this column should not be displayed).  My new attribute works fine when I hardcode it like this, meaning the HideColumnIn attribute is properly populated with the array of enum values:

<HideColumnIn(PageTemplate.List, PageTemplate.Edit)> _
Public Property My_DD_Column As Object

 

However, I want to store the values to be used for the HideColumnIn in the DB as integer values that correspond to the

reader.getordinal("column_may_not_exist") how to catch the exception?

  

hi,

would any body please help me to catch the exception if the column doesnot exist as my table columns are not static.

sometimes its throwing me indexoutofrange exception as the column doesnot exist

thanks for the help guys


Error while using exception handling block el 4.1

  

Hi Folks,

 

i am trying to use tyhe exception handling block of Enterprise library 4.1.

 

I just createda polisy and used IndexOutOfRangeException and added a replace handler and a logging handler to it.

I am using the NotifyRethrow PostHandlingAction to the exception.

 

During runtime I am getting an exception on the HandleException event, The exception is added below:

 

 

Object reference not set to an instance of an object.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.

Source Error:

Line 42:             catch (Exception ex)
Line 43:             {
Line 44:                 bool reThrow = ExceptionPolicy.HandleException(ex, "ReplacePolicy");
Line 45:         

userprincipal.changepassword throws exception

  

Hi all,

      userprincipal.changepassword(oldpassword, newpassword);

gives error: that is Configuration information could not be read from the domain controller, either because the machine is unavailable, or access has been denied. (Exception from HRESULT: 0x80070547)

but userDirectoryEntry.invoke("ChangePassword", new object[] { oldpassword, newpassword });

      userDirectoryEntry.CommitChanges works fine.

Any one please tell me the reason behind this.




active directory exception unusual behaviour

  

Hi 
i have a small problem
i want user names from active directory for an auto completer type of service
the method is always throwing an exception 
-------
"searcher.FindAll()' threw an exception of type 'System.DirectoryServices.DirectoryServicesCOMException' System.DirectoryServices.SearchResultCollection 

"Exception from HRESULT: 0x800AC472"

  

Am Exporting Data in to Excel File,meanwhile if i open any other Excel file than the excel File on which am exporting data gets opened up Automatically having name Book1.How should i stop these excel file not to get open.In the Error log i get an error message showing " Exception from HRESULT: 0x800AC472" . Need help on these.Thanks in Advance.


WebControls.TableRow throws exception on Add()

  

I have the following method to strip hidden and user-specified columns from a gridviewrow and return a tablerow. 

    Private Shared Function StripHiddenColumns(ByVal gvRow As GridViewRow, ByVal ColumnsToExclude() As Integer) As TableRow

        Dim row As New TableRow
        Dim i As Integer = 0
        Try
            For Each cell As TableCell In gvRow.Cells
                If cell.Visible Then
                    If Not ColumnsToExclude.Contains(i) Then
                        row.Cells.Add(cell)
                    End If
                End If
                i += 1
            Next

            Return row
        Catch ex As Exception
            Throw ex
        End Try
    End Function

However, when I run this code and hit the Add method for the TableRow,  I get an InvalidOperationException stating the Collection was modified; enumeration operation may not execute.  I've gotten this exception before, but usually it's because I'm attempting to modify a table that is databound.  This particular one is not, i am creating it.  Can anyone offer any insight? 

Thanks in advance.

thefunnyman


Categories: 
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