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

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

Error connecting to Web Service in C#

Posted By:      Posted Date: October 19, 2010    Points: 0   Category :ASP.Net

I am trying to access a web service and calling a method to pass my request parameters. I am programmatically setting my credentials, using:

service.Credentials = 
new NetworkCredential("username", "password", "domain_url");

When in the above code, I pass domain_url, I get this Web Exception in dialogue box while debugging.

Unable to automatically step into the server. Connecting to the server machine "ServerUrl" failed. Invalid access to memory location.

In the message property of the web exception I get "The request failed with HTTP status 401: Unauthorized."

And when I do not pass domain_url, that is,

service.Credentials = new NetworkCredential("username", "password");

It does not

View Complete Post

More Related Resource Links

Error in connecting to SQLServer 2005 from Management studio and neither able to start sql service


I had been using SQL server 2005 without any problem but a few days back I started having some problem with my Windows XP Professional sp2 that my pc used to go off after 5-7 mins everytime i started it. So I repaired the OS. Since then,when i opened SQL Server and tried to connect am getting this error---

TITLE: Connect to Server

Cannot connect to POONAM-C586A95C\SQLEXPRESS.


A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified) (Microsoft SQL Server, Error: -1)

I checked the state of sql serverand it is stopped. What should I do to bring it to running state?

I even added sqlservr exe file to the exceptions in the firewall but i dont think that could hav been a problem b'coz it was working perfectly without any changes in the firewall setting.

Why am I getting this error and how can I remove it?

Please help.

'Meter number is not registered ' error FedEx ship web service move to production



I want to integrate FedEx ship web service in my website. It works fine for local but for production it gives error. I changed test credentials by production credentials. also changed test url "https://gatewaybeta.fedex.com:443/webservices" by production url "https://gateway.fedex.com:443/webservices" But I am getting error that meter number is not registered. Please advice.

Custom tool error: Failed to generate code for the service reference 'CompanyService'. Please che


A little background because I feel I have an out of the ordinary architecture in place and don't know if this is contributing to the problem. 

We have an existing ASP.net application that is undergoing expansion.  The new functionality is all written in Silverlight 4.  As part of that expansion I gutted all the old Linq to SQL and put Entity Framework 4 into place.  To do this I created a standard .net Class Library and added my edmx files there.  Naturally, the business entities created by this cannot be used in Silverlight.  So I created a Silverlight Class Library and added all the business entities to that Silverlight Class Library as linked files.  I changed the name space to be the same.

So I have the following assembly / namespaces

Company.Project.Dal.csproj / Company.Project.Entities (.net 4 class library)

Company.Project.Entities.csproj / Company.Project.Entities (SL4 class library)

With this architecture I was able to share my business entities with my SL enabled web services, my asp.net projects, my silverlight projects.  Really it's a beautiful thing.

Once this was done I added "message" classes to Company.Project.Dal and again shared them with the other entites using linked files.  These messages are things like MyObjectRequest; they are class

"Your search cannot be completed because of a service error. Try ..."


i have a problem with search function where everytime i search any file/doc the error message "Your search cannot be completed because of a service error. Try your search again or contact your administrator for more information." occurred. I realized that there are items in central admin but it is "not available" in my site. I already follow several guides that had been provided in this forum but still the same. Even, i already create new SSP and configure the search scope, content source and also crawling. 

FYI, i used Microsoft Sharepoint 2007. 

Hope anyone could help me to solve this problem. Thanks.

RDL Rendering (500 Internal Server) Error at Sharepoint Integrated Reporting Service


I have a serious problem that cannot be solved by googling around the keywords below:
sharepoint, moss 2007, reporting service, ssrs 2008, rendering, internal server error, ....

The error is;

"An error occurred during client rendering. The remote server returned an error: (500) Internal Server Error. "

Everything is O.K.;

* When I render the report from the REPORTSERVER (http://localhost/ReportServer)
* When the reports are scheduled to be sent by the reporting service (planned via MOSS 2007) 

But if I open (render) the RDL file from the sharepoint REPORTS LIBRARY interface, all of the reports fail with that internal error message above. 

It is weird also that parametrized reports are displayed without errors although the parameters are queried from a sql dataset. But I got the error when rendering the report after I've chosen a parameter  and order "apply/report"...

Possible causes how I met that error may be;

After I have installed (then uninstalled) AJAX extensions
After I have re-configured IIS Web Service Extensions list items

Possible solution alternatives I've found;

I've found a solution on MSDN replying a similar issue with an ideal cause of the error but an evreka answer but no sol

Error connecting using SPSite

Has anyone seen this error message?

The Web application at http://ecnet/Pages/Default.aspx could not be found. Verify that you have typed the URL correctly. If the URL should be serving existing content, the system administrator may need to add a new request URL mapping to the intended application.

Errors on the line.

SPSite site = new SPSite("http://ecnet/Pages/Default.aspx");

It's a clean console application running on the SharePoint 2007 web server.

Any thoughts? I can't seem to connect to the Server like I used to in SharePoint 2003.

strange web service error



I wrote a small little vb.net app that should connect to a MS search server 2010 web service.


I added the web reference, which worked fine, but whenever I run the code, I get this strange error:




I Googled it, but found very little info on it.

Can anyone make sense of it?



Error Consuming Web Service - Unable to import binding xxx from namespace ...


In VS2008 / C# / ASP.NET 3.5, I wrote a test web service app. Here is an extract from the code:

namespace emed.MathWebService
    /// <summary>
    /// Sample Math Services For Learning Web Services Deployment
    /// </summary>
    [WebService(Namespace = " http://localhost/MathService")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    public class MathService
        public float Add(float a, float b)
            return a + b;


I have published this to an IIS virtual directory named MathService, and when I try to launch it with the URL http://localhost/mathservice/MathService.asmx is works fine and displays all the operations (Add, Subtract etc) in the service.

I then created a test web application in VS2008 (named WebSvcTe

web service soap mapper error question

Hi,I'm trying to connect to a web service using excel.I have currently no issues logging into the web service, and running one of the other functions to fetch a full list of data.  Once I am able to log in, the function returns a token, which I use to fetch data.But Currently, I'm getting the following errors one two of the functions:SoapMapper:Restoring data into SoapMapper ViewListResult failed HRESULT=0x80020009: Exception occurred. - Client:Unspecified client error. HRESULT=0x80020009: Exception occurred.Run-time error '-2147221504 (80040000)':SoapMapper:Restoring data into SoapMapper ViewListResult failedAny idea why I might be getting this error?  And also how I can fix it?  Thanks.

Error Build: Type or namespace could not be found, when referencing a web service

Hello, I'm new in writing C# application in Visual Studio 2008. I'm currently writing a web application for CRM 4.0 Reporting Service rendering. I reference my web application to our Reporting Service web service http://reportservername /ReportServer/ReportExecution2005.asmx and name it 'RSWebReference'. Then I want to reference it in my code: Using RSWebReference; Not sure why, but I cannot build my solution, saying "The type or namespace name 'RSWebReference' could not be found (are you missing a using directive or an assembly reference?)". I read this thread in http://social.msdn.microsoft.com/Forums/en-US/sqlreportingservices/thread/74f70e30-83e8-4817-b5e0-7729450730a1 that the website probably is using .net 1.1, and I should change it to .net 2.0. However, I think the website is already using 2.0. Is it probably because I'm using VS 2008? How can I tell and change if the website is using 1.1 or 2.0? Or could I be doing something wrong? Thanks in advanced for your help! -Elizabeth K.

Server ERROR: An error occurred during the parsing of a resource required to service this request.

I have created one asp.net 2.0 application and created a setup project. I run this setup in my local machine, the application run fine, but i uploaded into online server I met the following parser error.How to solve this error? Kindly help me. Very urgent.. Kamal....

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

Error in consuming web service using WCF client

Hi, I have consumed an external webservice in my client application using WCF. And every thing works great in my Dev box(XP with IIS5.1) But when the same application is moved to Prod server(Win Server 2003 with IIS6.0) it fails. Below is the exception caught: There was no endpoint listening at http://MyExternalWebServiceUrlWithSessionId could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details. And the InnerException is: Unable to connect to the remote server My Config file has the below settings:<system.serviceModel> <bindings> <basicHttpBinding> <binding name="Default_Binding" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536" messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true"> <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCoun

Error: The search request was unable to connect to the Search Service.

When attempting a search, I get the the error message "The search request was unable to connect to the Search Service. "  The search sevice has been started in Central Administration.  Does anyone have suggesting as to how to troubleshoot this issue?   Thank you in advance for your help.

Error calling WCF service that is returning list.".Debugging resource strings are unavailable ......

Ok.this is just making me frustrated... Here is step by step of what I am trying to do (& not able to) 1. I am calling WCF service hosted in a SharePoint 2010 site from a silverlight app in same domain (So no cross doman I guess). 2. I use Linq to Sharepoint for querying the DB. 3. I am having a list "machines" in Sharepoint 2010 that is having a lookup column from Other list called "part" 4. My WCF method GetAllMachines() works perfectly well when it skips the lookup column "partname" & returns List of type machineitem. 5. But problem occurs when I add machineitemobject.parts.partsname in my Linq to Sharepoint query . My service gives the error not found Async_ExceptionOccurred] Arguments: Debugging resource strings are unavailable." 6. Note that return type of my Method is List<machinesitem> 7. The point to note here is that I use SPMETAL tool to generate the LINQ class that maps the lists . So When I try to query the lookup column it tries to add List item of the type class & that is what causing the error. Is it because I am not using datacontract in my service (but it returns the strings & all private members of machines list e.g. name,title etc) Is it making the attribute Serialisable will solve the error ??? I am kind of lost in it ...Plss help!!   Thanks

The resource you are looking error when browsing web service

I thought this question has to go in IIS forum but I couldnt get msdn forum. So I am posting here. Excuse me if it is not appropriate forum to post this question. I was running a webservice on port 80 in IIS. Then I had to change the port to some other port (say 5555) and changed the host header.  When I try to browse this web service it is giving me error as  The resource you are looking for (or one of its dependencies) could have been removed, had its name changed.. I even look into my IIS homedirectory and the homedirectory local path is not having any trailing backslashes(as some blogs suggested) When I look into IIS log files the S-PORT is showing still 80 for this request. Is there anything to do eith this in my scenario? Please aid me regarding this.Best

Error Connecting to Server Using SQL Server Management Studio

Hello all, I am trying to connect to a SQL Server 2005 instance using SQL Server Management Studio and I am receiving the following error message. =================================== Cannot connect to VTWIN. =================================== A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server) (.Net SqlClient Data Provider) ------------------------------ For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&EvtSrc=MSSQLServer&EvtID=53&LinkId=20476 ------------------------------ Error Number: 53 Severity: 20 State: 0 ------------------------------ Program Location:    at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)    at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)    at System.Data.SqlClient.TdsParser.Connect(ServerInfo serverInfo, SqlInternalConnectionTds connHandler, Boolean ignoreSniOpenTimeout, Int64 timerExpire, Boolean encrypt, Boolean trustServerCert, Boolean integratedSecurity, SqlConnection owningObject)  &
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