WCF Error “HTTP Error 404.0- Not Found The Resource you are looking has been removed, had its name changed or is temporarily unavailable”.

Assalamualaykum Wr Br…These days I was interacting with WCF service using SOAPUI utility but when I try to access the WSDL of the Service an Error was encountered displaying that the “HTTP Error 404.0- Not Found The Resource you are looking has been removed, had its name changed or is temporarily unavailable” similar to this kind of error it was. At this point I would like to make clear how to access WSDL of Service? WSDL of the service can be accessed with the service file with extension as .svc for WCF and for web service it is .asmx. After much effort, finally with Allah’s SWT grace I found the solution to install some packages which are available at:
C:\Program Files\Microsoft SDKs\V7.0\ServiceModel.exe -i
Install these packages and also reset IIS then try again which resolves the issue…Hope this would help..

Jazakallah Khair…

Consume Calculator Service

Welcome to the part-2 of WCF…Run your service and copy the address which is available in WCF Test Client which is shown as:
address
Now create a new console Application as shown:
console
Right Click References in Solution and select Add Service Reference which populates a new window with entries as Address where you need to paste the address of your Calculator service which was copied in Very first step then click GO button and give a name to it as shown:
Serviceref Click on OK..Now client console application have a proxy service in it..just create a object of it then access its operation contracts by supplying required parameter values and get the result..sample of such code is shown as: code Just press Clrl+F5 then supply the values..

the final output would be as shown:

output

Thanks…Enjoy…

Now the same Calculator service we now going to consume in windows Application..

1. Create new windows application using C# language and name as Windows_Calculator.

2. Add service reference by right click on  solution and paste the URL of the service in Address bar as we did in console application above in two images and press discover button.

3. create the service_reference object and access their methods and code as shown in below image:

win_code

one thing we need to observe here is that we are not at all writing any logic code here in consuming clients because all logic is written in service and we just pass appropriate input and retrieve the results.The output of the above windows application would be as:

win_output

Hope would be helpful for anyone atleast…

Microsoft’s Powerful Service: WCF Walk through

Hi Everyone!!!
Today we are going to build a new WCF Service named WCF_Calculator in part 1 and in later sessions we consume this service in console application, Windows Application.

To create a new WCF Service, Start your visual studio 2010, Click on New Project–>Window gets populated..Select C# language and WCF from left most pane–>Select WCF Service Library and give name to your service(here I gave name as WCF_Calculator) as shown below:Untitled
Now Click on OK. The solution looks like as:

solution

IService1.cs and Service1.cs are auto-generated files. As we are building Service from scratch hence we delete IService1.cs and Service1.cs files in order to know the behavior of service very well. Select these two files from the solution then right click of mouse and select Delete.
Now add new item by right click solution then add interface named “ICalculator.cs” then code as shown:
Interfaace
We are very to near to pack up..have little patience please….As we have interface ready with us…
Every interface need to be implemented, so now right click your solution and a new item select class name it as “Calculator.cs”. Code the class as shown below:

Calculator
Now the very last step to fly is open App.Config file and change the interface name which was IService1 to ICalculator in endpoint tag Contract value and also change service tag attribute name=Calculator which is our class name which is implementing our interface. Here our App.Config should look as:

Appfile
Now Press F5 and your service is in the air…Microsoft Built in WCF Service Host Tool is available which runs our service shown as:
output1
To the left most pane we find our OperationContracts named Add,Sub,Mul and Div…Click on Add then supply values to arguments which is shown in below image as 234 and 432 and click Invoke Button which displays result as:
output2
similarly click each of the OperationContract and supply values and click Invoke button to retrieve result…
We are done in Creation of the Service…In next part WCF 2 we look at how to consume this Calculator service in Console and Windows Service…Thanks…Enjoy…