.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

calling WCF service Method in HTTP GET by browser or ASP.NET ( like HttpWebRequest for example)

Posted By:      Posted Date: August 29, 2010    Points: 0   Category :WCF
Can i call a WCF service Method using HTTP GET by browser or ASP.NET (without WCF Client)? it can be done with asmx web service.... but i can't find a way to call a WCF service Method with HTTP GET through the browser or C# ASP.NET Code... can i do that ?

View Complete Post

More Related Resource Links

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

Calling a Web Service Method Asynchronously does not work in Console Application

I have a web service that has a CreateReport method that generates a report based on the specified criteria. When I call this method Synchronously using a Windows Application or Console Application, the call works fine and the report is created. When I call this method ASynchronously (CreateReportASync) using Windows Application the report is created. When I call this method ASynchronously (CreateReportASync) using Console Application the web service does not even get the call.  I am using VS2005 and .Net Framework 2.0.  So the proxy is automatically created with the Async methods.  I am not really interested the result of the method call, so I do not add a Callback Delegate.  

create web service with http-post method


hi All,

we need to expose a web service to the 3rd party vendor which can only call using POST protocol, NOT SOAP.

So my question, is it better to build a web service or just simply .aspx page?

Also is there any best practice documentation on this.



How do I use x-http-method-override for a REST service in WCF 4.0


Back in WCF 3.5 using the WCF REST Starter Kit, I was able to create a request interceptor to handle x-http-method-override headers for clients that cannot send PUT or DELETE commands.  How do I do the equivalent in WCF 4.0?

Web Service - Different Operation Contracts calling the same method

I would like to know how could I define two operation contracts (JSON, XML) which call to the same method; I have defined web and basic http bindings for all the Operation Contracts in the way that they could be called from HTTP requests (jQuery) and from Silverlight.

This first example works because the methods have different number of input parameters. But I need to add the attribute name to the Operation Contract.

        [WebInvoke(Method = "POST",
            UriTemplate = "1/json/getRegions",
            ResponseFormat = WebMessageFormat.Json)]
        RegionListOutput GetRegionList(int countryID, int other);

        [OperationContract(Name = "getRegionsXML")]
        [WebInvoke(Method = "POST",
            UriTemplate = "1/xml/getRegions",
            ResponseFormat = WebMessageFormat.Xml)]
        RegionListOutput GetRegionList(int countryID);


SoapException when calling web service method.


Hi all,

I am stuck with this for a 2 days now. I have referenced 3rd party web service in my project. I am programmatically setting credentials to the service. Within debug it shows the dialogue box when calling web service method saying, Also within the debug it says,

Unable to automatically step into the server. Connecting to the server machine 'domain' failed. Invalid access to memory location.

And when I step out of the code it catches, System.Web.Services.Protocols.SoapException.

I did a Response.Write on all properties of this SoapException and got this string.

MESSAGE: Internal Error, CODE: http://schemas.xmlsoap.org/soap/envelope/:Server, DETAIL: System.Xml.XmlElement, NODE: , HELPLINK: , ROLE: , ACTOR: , INNEREXCEPTION: , IP: ::1

It returns Internal Error with no error code and I am stuck as what possibly I am doing wrong that is causing this exception. I am unable to check the resulting Xml generated behind the scene becuase it is not logged on the server web service is hosted on. Or if there is a way to fetch Xml when I call method on service, let me know. Thanks.

Please help me solving this horrific problem...

Calling a data-driven web service method asynchronously


I am trying to write a Windows Service which will call web service methods based on a run schedule.  I have setup a ‘schedule’ table which holds the name of the web service method and some scheduling details (e.g. run every day at 0200).  I am using VS 2005/vb.net.

My service creates a timer which runs every minute and when the timer is fired the schedule table is read and  any entries which are due to fire are actioned.  This could mean multiple methods being fired at the same time.  As some of the methods are overnight batch processes and may take some time, I don’t want processes to wait for others to finish before being actioned.  As the methods themselves write to the system log to report their success or failure the scheduling service does not care whether the job fails or not – it is simply doing a ‘fire and forget’ exercise.

What I need is some code which will fire a data-driven web service method asynchronously.

I have investigated two types of method call.  The first is a simple InvokeMethod:-

mywebservice.GetType().InvokeMember(ScheduleRow("WebMethod").TOString(),(Reflection.BindingFlags.InvokeMethod Or Reflection.BindingFlags.IgnoreReturn), Nothing, mywebservice, Nothing)

The second is an asynchronous call:-

Dim asyncCall as New AsyncCallB

Calling parameterized method from aspx file


Hi all,
I have following method
 public string GetYoutubeVideo (string code)
        return "asasdasfa"

How do I get the http method?



I've a problem to get the http method.

I would like to know how do I test if the page send to my website is "post", "get" or "head", and I would like to stop the process if the page is "head".

Can you help me?

Thanks by advance. 

http module calling order


Our site uses urlRewriter http module that does the url rewriting for us.

I want to create another http module that will handle our customize URL redirects. Now I want this new customize http module to be call before the UrlRewriter module (to avoid page not found messages the UrlRewriter generates). Is there a way we can contol the calling order ?

VS2005 calling VS2010 asmx service returns empty string


Anyone have any experience with this?

We are using VS 2005 for the front end, and vs 2010 for the web services part (asmx), not wcf yet.


Web service works just like the vs2005 when run locally, no problems.


Connecting to it from a test app returns an empty string. Connecting to a 2005 app doesn't!

Anyone run into this before or have a suggestion? Surely vs 2005 can connect to web services from a later version?






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

SQL Server 2005 - Installation in Cluster Environment - "Service SQL Server Browser (SQLBrowser) fai

Windows Server 2003 R2 Enterprise Edition SP2 32-bit All updates and patches installed Two-node cluster environment configured. Cluster functions perfectly. Trying to install SQL Server 2005 Enterprise Edition (32-bit) as a clustered application. Installation proceeds fine until it begins to install the SQL Server Database Services product. Status window says "Starting Services. Service: SQL Server Browser". Error message is presented: "Service 'SQL Server Browser' (SQLBrowser) failed to start. Verify that you have sufficient privileges to start system services". SQL Server Service Account is in the Administrators group on both local systems, and is a domain account. Account used for the installation is in the Administrators group on both local systems, and is a domain account. Have cancelled out of the install and rebooted both servers numerous times. Exact same error continues to occur. Cluster is active and all resources are owned by node #1 - the node where SQL Server Installation is being run. In the event viewer, I see: Event ID: 10 Description: The SQLBrowser service was unable to establish SQL instance and connectivity discovery". I am also seeing errors like: Source: SQLBrowser. The SQL configuration for SQL is inaccessible or invalid. Source: SQLBrowser. The Configuration of the AdminConnection\TCP protocol in the SQL instance xxxxxx i

Calling an asp.net web service from jQuery

As I have post it in earlier post that jQuery is one of most popular JavaScript library in the world amongst web developers Lets take a example calling ASP.NET web service with jQuery . You will see at the end of the example that how easy it is to call a web service from the jQuery. Let's create a simple Hello World web service. Go to your project right click->Add -> New Item and select web service and add a web service like following.   Now modify the code of web service like following. [WebService(Namespace = "http://tempuri.org/")][WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)][System.ComponentModel.ToolboxItem(false)]// To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. [System.Web.Script.Services.ScriptService]public class HelloWorld : System.Web.Services.WebService{ [WebMethod] public string PrintMessage() { return "Hello World..This is from webservice"; }} Here please make sure that [System.Web.Script.Services.ScriptService] is un commented because this attribute is responsible for allowing web service to be called by Client side scripts. Now to call this  web service from jquery we have to include jQuery Js like following. I am already having in my project so i don't need to include in project just need to add script tag like following. <script type="t

calling a web service on a remote server from an ASPX page

hi, I want to call a web service on a remote server. I've done "add web reference" in my project, and VS2005 has created the .discomap and .WSDL in the App_Web_Reference folder. When I try add the namespace representing the web server (the name I created when I added the web reference) by "using XXXXX;" the code does not compile because XXXXX is not defined. Have I missed any steps? thanks, -me

calling a web service on a remote server from a ASPX page (web site project VS2005)

HI,I am maintaining a web site project in VS2005 and have to call a new web service on a remote server. I've done add web reference, and created the .wsdl and .discomap files in the app_webReference folder.  When I try to create a object representing the web service in the code ( wsnamespace.serviceName ws = new wsnamespce.serviceName(); ) the code wouldn't compile.The web site project is already calling other web services. When I right click on the type representing the web service and "go to definition" it takes me to a proxy class (derived from of course SoapHttpClientProtocol) in the metadata. I think this is what's missing for  the new web service i'm trying to call. Have I missed any steps?Thanks in advance.-me

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