.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

WsHttpBinding: No FaultException for http status code 400 (for 500 everything works fine)

Posted By:      Posted Date: October 19, 2010    Points: 0   Category :WCF

A .NET client consumes web services using Soap 1.2 via WCF. The services generate SOAP errors with http status code 400 and body containing SOAP fault code as well as subcodes. The client side exception that is thrown only contains InnerException = {"The remote server returned an error: (400) Bad Request."} without ability to access SOAP error code information.

For http status code 500 type of errors everything works fine by raising a FaultException with information.

Is there any flag to get it working for http status code 400 as well?

View Complete Post

More Related Resource Links

i cannot access iis virtual directory using http protocol..getting status code error 403

i am trying to connect to remote exchange using powershell..while using powershell session i get status error 403...i changed the settings in iis manager...i have set all the settings in the iis manager as said in the msdn support blogs...yet i get the same error when i access it in the client url and also in powershell of the client computer...if i cannot connect using powershell,can i connect using .net???somebody help me...i am beginner and i am stuck...

Code works on aspx but not ascx


Not sure which category to put this question in, so I will put it in here.

Just to give you an idea of the layout of my solution, I have the main project, along with 2 class libraries, BLL and DAL.  (Business Logic Layer and Data Access Layer)

The BLL refers to the DAL and the main project refers to the BLL.

I had a test website and the code worked fine, but the same code will not work on the real project. The only difference is that in the test project, the code was on an aspx code behind, whereas in the real project, it is an ascx code behind (Web User Control )

The code is:

Dim connectionString As String = ConfigurationManager.ConnectionStrings("ASPNETDBConnectionString").ConnectionString
        Dim recordEntry As New UserRecord(connectionString)
        recordEntry.UserName = "TestName"
        recordEntry.BMI = bMI
        recordEntry.BMR = bMR
        recordEntry.FTM = fTM
        recordEntry.TDEE = tDEE
        recordEntry.TodayDate = dateForToday

Dim connectionString As String = ConfigurationManager.ConnectionStrings("ASPNETDBConnectionString").ConnectionString

Change the Workflow Status through code


HI Folks,

I have a scenario where i need to develop a 6 stage approval workflow(sequential) using WWF and depoly it to sharepoint. Everythigns fine till here.

Now we look ahead to change the Status field on the documents library which actually has the Workflow Name as the column name and its value being In Progress, depending on the stage of approval. Like(Approved 1, Approved 2, Approved 3.)

And if rejected the status should be rejected than Completed. Any idea how can we update this column of the List item.

I have tried item[workflowProperties.Workflow.ParentAssociation.Name]="Approved 1";

But this throws an error saying input string is not in a correct format.

Any information would be of great help :)


Sreeharsha Alagani

Anonymous Web Site receives "The request failed with HTTP status 401: Unauthorized"


I set up a test website on my local box and was able to access sharepoint search using the querySearch web service from SP.  After I got it all working properly I transferred the code to the target website that is set up with anonymous access for all people on the fab floor.  However from this website I keep getting the 401 error.  It can't be SP because the same code worked from my local website "localhost".  Any suggestions?  we don't want to have to have the fab people log in so we can't not have the box anonymous.  I would appreciate any suggestions very much!!!

Using WSS 2007 with MOSS.


  private void GetDefaultCredentials()
      m_where = "get configuration data for credentials";
      string userid = ConfigurationManager.AppSettings[ "userid" ];
      string password = ConfigurationManager.AppSettings[ "password" ];
      string domain = ConfigurationManager.AppSettings[ "domain" ];

      m_where = "set search query credentials";
      m_query.Credentials = new NetworkCredential ( userid, password

Toggling of iFrames works fine in Firefox but not in IE


I have different iFrames on my page and one of the iFrame has pdf plugin that shows the PDF document and i have another iFrame that pops up on delete button click and  a function to toggle the iFrames. It works fine in Firefox but in IE my pop up iFrame is always behind the PDF. 
Any thought how can I set it right, there is some issue with the z-index of PDF, it is set to infinity something like that in IE ! 


Javascript fails in chrome and firefox, works fine in IE



I am customizing Newform.aspx i.e. hiding some fields, making other readonly etc. It works fine in IE but fails miserably in chrome and firefox i.e. readonly are no more readonly, hidden are no more hidden. Here is my code:

<script language="javascript" type="text/javascript">
    function autoFillFields()
       var ctrl = findacontrol("Reference Customer");
    var param = getURLParam('RefFromCust');   
    var properParam = replaceCharacters(param);
    ctrl.value = properParam;
    var ctrl = findacontrol("RefReqOpptyId");
    var param = getURLParam('OpptyId');   
    var properParam = replaceCharacters(param);
    ctrl.value = properParam;

    param = getURLParam('RefFromAE');
    properParam = replaceCharacters(param);
    setPeoplePicker("People Picker", properParam);
    hideFldCtrl("Approval Sta

this my query works fine, i need to eliminate when resultset zero

hithis is the query working fineSELECT a.Selection,a.SizeRange,a.Thickness,       ISNULL(a.Assotment,0) - ISNULL(b.Issue,0)  AS difference1      FROM ( SELECT Selection,SizeRange,Thickness,                SUM(Pcs) AS Assotment            FROM  dbo.WBCAssortDescp where LotNo='LWC2'          group by Selection,SizeRange,Thickness) AS a LEFT OUTER   JOIN (SELECT Selections,SizeRange,Thickness,                SUM(Pieces) AS Issue            FROM dbo.WBIssue Where LotNo='LWC2'           group by Selections,SizeRange,Thickness) AS b on b.Selections=a.Selection and b.SizeRange=a.SizeRange and a.Thickness=b.ThicknessSELECT a.Se,a.Si.Th,      ISNULL(a.ent,0) - ISNULL(b.Ise,0)  AS difference1   FROM ( SELECT Se,Si,Th,               SUM(Pcs) AS ent           FROM  dbo.Table1where No='C2'         group by Se,Si,Th) AS aLEFT OUTER  JOIN (SELECT Ses,Si,Th,               SUM(Pieces) AS Ise         &nbs

WebFaultException throwing a "not handled by user code" error and returning an HTTP 500 to the clien

I am trying to return a BadRequest and simple message when implentation throws an error in a WCF REST service, but the WebFaultExcption itself is throwing an exception and returning an HTTP 500 instead. Any ideas on why this might be happening? Here is a short code snippet: [WebDispatchFormatter] [WebHelp(Comment="Initiate an immediate or callback appoinment request")] [WebInvoke(UriTemplate = "InitiateContact", Method = Verbs.Post)] public string InitiateContact(AppointmentRqst rqst) {      string ret = string.Empty;      rqst.DeviceId = Helper.GetHttpAuthHdrDeviceId();      try      {          ret = impl.InitiateContact(rqst);      }      catch (Exception ex)      {          throw new WebFaultException<string>(ex.Message, HttpStatusCode.BadRequest);      }      return ret; }

While calling Web service gets exception "The request failed with HTTP status 401: Unauthorized"

Hi All, I created a ASP.NET web service, which was hosted on default visual studioserver, and on excecution of webservice it run .exe file which in turn update xml file. Now i hosted this webservice on IIS 6.0 server, and when i run the service, itfails to execute the exe.When i run it on debug mode, i never get any exception.Code...public string HelloWorld()    {        Process myProcess = new Process();        try        {            myProcess.StartInfo.UseShellExecute = false;            // You can start any process,             myProcess.StartInfo.FileName = @"E:\Projects\some.exe";            myProcess.StartInfo.CreateNoWindow = true;            myProcess.Start();            myProcess.Close();            myProcess.Dispose();            return "Suceess";         }&n

The status code returned from the server was: 500

  I am getting the following eroor , when using the UpdatePanel of Ajax Sys.WebForms.PageRequestManagerServerErrorException: An unknown error occurred while processing the request on the server.The status code returned from the server was: 500 To my strange ,the error is thrown not all the time , only in some rare cases which could not be found out . I tried to increase the AsyncPostBackTimeout to 300 which was 60 but i could n't  get the error down  installing the ajax set up in server is must or not ?  We just placed the ajax dlls in the server. Please can anybody help me with right solution.   Regards G Suresh Kumar         

Javascript Error in Internet Explorer but works fine in Firefox

Hi All,i was working on one of the project as it is working fine in Firefox but it is giving the javascript exception in internet explorer.Errror:  Error says  "s" is undefined in the s.currencyCode="USD" line but "s" is defined in the external javascript file  s_code.jsCan anyone suggest the solution for this issue:Please find my code where the error is displayed <script type="text/javascript" language="JavaScript" >var s_account="mnsdev"</script><script type="text/javascript" language="JavaScript" src="http://media.world.com/ads/usen/rpt/Omniture/s_code.js"></script><script type="text/javascript" language="JavaScript" >s.currencyCode="USD"s.charSet="ISO-8859-1"s.SEMct = s.getQueryParam('s_kwcid');s.SEMct = s.getValOnce(s.SEMct,'SEM_ct',0);s.clickPast(s.SEMct,'event9','event10');s.SEMvar=s.getQueryParam('s_kwcid');s.SEMdate=new Date;s.SEMdate.setTime(s.SEMdate.getTime()+60*86400000)if(s.SEMvar){s.c_w('SEM_ck','1',s.SEMdate)}s.SEMchk=s.c_r('SEM_ck');if(s.SEMchk&&s.events)s.SEMok='ok';if(s.SEMvar||s.SEMok) s.t()

MDX works fine in SSMS but not in query designer

Hi all,   I am trying to include this query in my query designer in SSRS. The query below is as follows:WITH MEMBER [Time].[Fiscal Month].[All].[ Subtotal] AS ' AGGREGATE( EXISTING { [Time].[Fiscal Month].[All].CHILDREN }) ', SOLVE_ORDER = 1000  SELECT NON EMPTY { { { { [Time].[Fiscal Month].[All].CHILDREN }, { [Time].[Fiscal Month].[All].[ Subtotal] } } * { { [Measures].[SKU Distinct Count] } } } } ON COLUMNS , NON EMPTY { [Sales Force].[Retailer Code].[All].CHILDREN } ON ROWS  FROM [Sales]CELL PROPERTIES VALUE, FORMATTED_VALUE, CELL_ORDINAL The error i am getting isThe query cannot be prepared: The query must have at least one axis. The first axis of the query should not have multiple hierarchies, nor should it reference any dimension other than the Measures dimension..Please let me know where am i going wrong.Thanks and regards,ram

.aspx page when browsed with chrome browser works fine but with IE8 it displays "Internet explorer c

HiI have VS 2008 installed and have  IE8 browser as well as google chrome browser.However wheneever i try to run a .aspx page in solution explorer of VS with the browse with.. options,the page runs fine with chrome browser but not with IE8.The IE browser shows the error "Ineternet explorer cannot display the page".I have set the IE as the default browser in the browse with ... option of the VS 2008.Please suggest.

Ldap authenication code is not working with IIS but works with Visual Studio developement webserver

Hi,I have weird issue here, I have a method that  takes a login Id and authenticates with LDAP active directory and returns the employee Id.It works great when I run the application in Visual studio 2008 ( it uses the default visual studio developement webserver). The code authenitcates the login id and returns emp Id perfectly. But the problem comes when I publish the code to the Local IIS in my developement PC.public string GetEastWestTeamMembersEmployeeID(string loginID)        {            string domain = string.Empty;            string login = string.Empty;            int position = loginID.IndexOf(@"\");            string empid = "";                  System.DirectoryServices.DirectoryEntry directoryEntry = null;            if (position >= 0)            {                domain = loginID.Substring(0, position);    &n

Custom masterpage Layout works fine, but WIDE sharepoint lists flow through, over design

Hello all, and thanks in advance for any help. We've built a custom masterpage layout and so far it works great.  We have specified a layout based on tables that fix the width at 960pixels.  The tables are centered on the screen and have a particular background that is different from the page's background to make the content pop.  It works fine in most cases and still displays all MOSSs dynamic contents like the quicklaunch bar at left, etc.  The theme sort of looks like this : http://www.sharepointpackages.com/index.php?main_page=product_info&cPath=65&products_id=268&zenid=a045f5b7dba91fdab94d754569e0b611 The problem is that when a list has too many columns and is therefore wider than the 700 or so pixels that are left over for the placeholders inside the table, the list continues on, but does not affect the table itself.  In other words it appears as if the content was placed OVER the tables in the layout.  This is odd first of all, but it is actually bad in a way, because even if I use styles on the table cells that hold these placeholders, and have the overflow use scrolls, the table ACTUALLY does not see an overflow and the contents continue to run through without activating the scrollbars (they don't even show up).  Can anyone help.  Please, Please, I've been looking at HTML for two days straight now trying to fi

How do I add smtp status code to this?

I have this code that logs an error when it occurs at the application level.  This is in a class of it's own.  I then have the logic in the global asax file that calls this code and passes in the base and inner exception along with some other info.I want to add the smtp status code to this so it's captured when an error occurs.  I think this will make it easier to figure out what's wrong when something goes wrong.I'm not clear on the best way to capture the smtp status code though.  How should I add this to this code?Global.asax file: protected void Application_Error(object sender, EventArgs e) { // Code that runs when an unhandled error occurs Exception baseException = Server.GetLastError().GetBaseException(); Exception innerException = Server.GetLastError().InnerException; string stackTrace = Server.GetLastError().StackTrace; // gets the name of the application that caused the exception string source = Server.GetLastError().Source; string baseException2 = baseException.Message.ToString(); string innerException2; if (innerException != null) { innerException2 = innerException.ToString(); } else { innerException2 = "Inner exception is null

uploading a file with wcf works fine with local drive, but only 4096 kb uploaded when I use unc stor

Hello I'm writing a wcf service for uploading files to a server. It works fine when I try to upload the file to the servers local c:/ drive, but if I use a UNC path only 4096 kb is stored. It actually looks like part of the file is lost while storing it with writeStream.Write(buffer, 0, bytesRead);, because I wrote the bytesread to an sql table and the number of elements are always the same no matter how many times I upload the file, but the stored file is always different sizes, ranging from 1996 kb to 4092 kb.   I'm using IIS 7.5 on a windows 7 enterprise machine. My IIS is using a administrator account for the application pool, so it should not be a problem with permissions.   My wcf method uses Stream to upload the file in chunks    public void UploadFile(RemoteFileInfo request)         { //some methods to set the filepath                                   int chunkSize = 4096;                                 byte[] buffer = new byte[chunkSize];                                 Stream writeStream = new FileStream(filePath, FileMode.CreateNew, FileAccess.Write);  &
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