.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

Web Exception while accessing a Web Service from C# Windows application . Please help

Posted By:      Posted Date: December 04, 2010    Points: 0   Category :.NET Framework

Hi ,

I am trying to consume a webservice from windows application for localtime service.

When I try to fetch the results my application fails with an web exception : Please find the below exception details.

System.Net.WebException was unhandled

  Message="The request failed with HTTP status 407: Proxy Authentication Required."



       at System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall)


View Complete Post

More Related Resource Links

Cash Drawer - Method Open threw an exception - Windows Service

Hi All, I'm getting the following exception while calling Open method of Cash Drawer object. Method Open threw an exception.  Could not read the device name key's default value, or could not convert the Programmatic ID it holds into a valid Class ID. Code:   class Class1 { CashDrawer _uniCashDrawer1 = null; DeviceInfo cashDrawerDevice1 = null; PosExplorer posExplorer = new Microsoft.PointOfService.PosExplorer();   public void ClaimCashDrawer() { cashDrawerDevice1 = posExplorer.GetDevice("CashDrawer", "testDrawer"); if (cashDrawerDevice1 != null) { _uniCashDrawer1 = posExplorer.CreateInstance(cashDrawerDevice1) as CashDrawer; if (_uniCashDrawer1 != null) { _uniCashDrawer1.StatusUpdateEvent += new StatusUpdateEventHandler(UniCashDrawer1_StatusUpdateEvent); _uniCashDrawer1.Open(); _uniCashDrawer1.Claim(0); _uniCashDrawer1.DeviceEnabled = true; } } } }   Tha above code works fine if you put the code in WindowsApplication in all POS systems. The same is working if you put the code in Windows Service in all other POS systems. The same is not working if you put the code in Windows Service in Aures Galeo POS systems.  Thanks in advance. Ramakrishnan S

'System OutOfMemory Exception' while using rdlc in Windows application

hi Everyone , I am Using Reporting Service (.rdlc) in my Windows application , i am getting Error System OutOfMemory Exception Like "an error occured during local report processing An Unexpected error occured in Report Processing Exception of type 'System OutOfMemory Exception'Was Thrown " what to do Please anyone help me ... Advance Thanks Anilmarnal

how can we show error in our application when exception occur in webs service

how can we show error in our application when exception occur in webs service

Accessing a WCF Service Application from a web application

Hi,I have a VS2K8 solution with a web app and a WCF Service App. In my web app I've added the service reference and can get to the service in the service app from code behind:WebTest.ServiceReference1.Service1Client prox = new       WebTest.ServiceReference1.Service1Client("WSHttpBinding_IService1");            fromStandAlone.InnerHtml = prox.GetData(9);            prox.Close();Can someone post a walkthrough on how to add an AJAX Enabled WCF service to the service app and how to access it from the web app?

How to Find out Windows service application path from Code ?

Dear frnds, Could you please help me to find out the path of  windows serivce exe ( application path ) from code?   Regards. Sajid P K  

Accessing a published web service gives null ref exception. Won't occur in test though?

I have an Asp.net web service that I created using Visual Studio 2005. I can acess the web service in my testenvironment, call methods and return data as expected. If this web service is published to the outside world (Outside of the company firewall), it will return a null reference exception. Does anyone have any idea why this might be happening? The same code is being used,against thesame database. The only difference is that the published website is giving back the null reference exception. If I type in the URL for the web service "https://secure.theSiteGeist.com/wsIndigo.asmx" a list of methods forthe web service is displayed in my browser. Yet if I try and call any methods on the web service I getback the null reference exception. Note that the URL I posted above is not the real name of my web service, but isjust used for reference sake.

Hosting web service inside Windows Application

  I would like to host my web service inside windows application. I prepared a short example basing on: http://msdn.microsoft.com/en-us/library/aa529311.aspx I have 2 projects created with default templates: Web Service project where I did not change anything: namespace WebService1 { [WebService(Namespace = "http://tempuri.org/")] [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)] public class Service : System.Web.Services.WebService { public Service() { } [WebMethod] public string HelloWorld() { return "Hello World"; } } } Windows Project in which I changed only the main form class: public partial class Form1 : Form { public Form1() { InitializeComponent(); Uri address = new Uri("soap.tcp://localhost/TestService"); SoapReceivers.Add(new EndpointReference(address), typeof(WebService1.Service)); } } The problem is that when I compile and run this Windows Application, I can`t discover this Web Service. There must be something wrong in my solution. Could you please help me by telling what may be wrong? Thank you for help in advance.MCP

Using Windows Service in Web Application.

Hi All,I wanna embed the windows service in the web application. I have seen few posts in the web. where they generate separate exe for the windows service and use it as an installable. The same process i tried doing it but it threw an OS error in my server which is windows 2000 and didnt supported the executable.However the website of mine runs fine in the same server. Thus i was thinking if i cd embed the same code in the web application.Also, in my case the website of mine takes job for simulation. These jobs are taken for simulation execution and nearly takes 12hrs for completion and if they are not completed within twelve hours then they are supplied extra twelve hours to complete the simulation jobs.The simulation executables are a series of executable and bat files.The results of the simulation gets updated in the tables of MySql and hence are displayed to the user.Please let me know as how shd i go abt it.Best Regards,Sharad Jain

the list cannot be imported because a windows sharepoint service-compatible spreadsheet application

I have googled this for 3 days now, without any solution. I have install, reinstall services and ms office, save as web the excel file for import, without any results, have anyone encounter this error. I need help.

SelfHosted WCF Service in a Windows Form Application

Hey,   I have a simple console app that is a self hosted service and a second console app that acts as the client.  I can pass a message between the client and service.  Obviously for this to work the service has to stay up and running, so I put a Console.ReadLine(); command as the last line in the service console app to prevent the service from closing until the user presses enter. My problem is, I would like to (self)host the service in a windows form.  If, for example, I put the ServiceHost decleration in the form load method, the service does not stay open once the form load method is complete. Does anyone have any tips on how I can self host the service in a windows form application and keep the service alive?   Thanks ;o)

Convert 'Windows Application' to 'Windows Service' .... imposible?


Hi all!

I want run my server application as system service, but i starts the project as 'Windows Application' ... how to convert it now to 'Windows Service' ? :S

I try to add the component "Windows Service", and change the "Application type" to 'Windows Service', but i can't select 'Service1' as my "Startup Object", then when i register de service and launch it from the "Services" magnagement mmc  ... die at 30 seconds because the services mmc can't comunicate with it :(

Nevertheless, if i create a new project like 'Windows Service' runs ok.



How to write the Web service in asp.net for Windows mobile application which find the nearest Restu


hi , i am developing the window mobile application in Asp.net, which will find the nearest Restaurant map on window mobile, but i am new to asp.net ,

  how to write the web service  in which i send my location address and  through window mobile and the web serivce find the neareset Restaurant map on window mobile ,

can this is possible ?

please help me

i dont know how to write the web service for this problem ,


please help me


many thanks in advacne


Connection Pooling VS Steady Connection in Windows Service Application


Hi All,

We are developing a windows service application which queries the sql db every second. For now, we have enabled connection pooling and every time we open and close connection at every access. Since it is a windows service can I open connection at service startup and close the connection shutdown

Please let me know the right approach in this scenario.





"Windows SharePoint Services Web Application" service is showing 'Error starting'.


I just installed MOSS SP2 and ran the config wizard on the server.
I am facing issue with our farm. Found that "Windows SharePoint Services Web Application" is in a problem.

I tried below commands:-
stsadm -o provisionservice -action stop -servicetype spwebservice -servicename ""
stsadm -o provisionservice -action start -servicetype spwebservice -servicename ""
But getting error:- Provision of service failed. Additional information: 1387.

Checked eventvwr and found below error log:-
Event Type: Error
Event Source: Windows SharePoint Services 3
Event Category: Topology
Event ID: 7034
Date:  10/21/2010
Time:  5:16:10 AM
User:  N/A
Computer: <Servername>
An attempt to start/stop instance  of service Windows SharePoint Services Web Application on server <servername> did not succeed. Re-run the action via UI or command line on the specified server.

None of the sites are working and I cannot see anything in the IIS folder nor in the IIS manager. All application folders are missing. But, I can see all the sites & Content databasesin the Central Admin.

Can someone please help?


Windows Service crash - catch exception


A windows service written in C# is intermittently crashing on a server. If I want to log the reason for crash, can I add try catch block in OnStop method?

will onStop  method get initiated on crashing?

protected override void OnStop()

Windows 2003 64 bit - Web App gives "is not a valid Win32 application. (Exception from HRESULT: 0x80


I've got an x86 deployment which is targeted at x86 and works fine on 2003 server 32 bit.

When I install on win 2003 x64, the installer works OK, but I cant get the first web page to display.

I've done a fair bit of googling but not found an answer yet

The error message is:

Server Error in '/MyCompany' Application.

is not a valid Win32 application. (Exception from HRESULT: 0x800700C1)
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.BadImageFormatException: is not a valid Win32 application. (Exception from HRESULT: 0x800700C1)

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. 

Stack Trace:

[BadImageFormatException:  is not a valid Win32 application. (Exception from HRESULT: 0x800700C1)]
   System.Reflection.Assembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean thro

OCX Control for Windows Service application


I need to use a custom OCX control with a Windows Service application.

I have built a Windows Form application test harness to test interoperability with the OCX control. To do that I added the OCX to the Toolbox, dragged it onto the form and used it successfully.

I now want to do the same in the Service application. However when I create and open the project the OCX control has disappeared from the toolbox.

I have read some similar posts from the past and the general response is that there is no need for an OCX control in a Service application because the service has no visible real-setate to use the OCX on. However in this case the OCX does not have any visual components. It is used to expose functionality to communicate with a third party application. The same third party has provided the OCX to allow others to implement certain functionality in their applications.

Is there any way to be able to use this type of OCX in a Service application? If not, is there a work-around?


Bas Groeneveld

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