how to debug a WCF service once it's out of dev env - wcf

I have a WCF service that i've been able to communicate with fine while it's hosted locally.
I have it deployed to a web server in IIS now, and I can get the wsdl file without error by navigating to http://site.com:8000/service/servicename.svc?wsdl
in trying to test this, i've created a console app and was able to successfully add a service reference to this. But when I try to run a Get() method on the service reference, it just hangs with no response.
How can I begin to debug this?
Thanks!

When you have a service that works in dev but not in IIS, it is often due to a problem with the WCF configuration:
Is the configuration in place (since you can add service reference it probably is)
Is the protocol you are using available. The configuration you are using must match what is turned on. For example are you using nettcpip binding without WAS.

Related

System.ServiceModel.AddressAlreadyInUseException: HTTP could not register URL http://+:8733/Design_Time_Addresses/WcfService/MathOpeationService/

I am trying to create wcf service and want to host on windows service.and install that service on windows.
so what I did I add wcf service library then built and run. after that its does successfully.
but when I create anther WCF appilcation so shows me this error= System.ServiceModel.AddressAlreadyInUseException.
SO how can I solve this issues please help to resolve this issue.
I install InstallUtil.exe but process not start on windows.
I want to host my WCF service on window and consume that service on my client application
First, I suggest you use WCF service application Template to create WCF service.
The error mainly indicates that the http address is already in use, we could change the port number and try it again.
At last, we had better use administrator account to install/run the windows service since the system layer driver (http.sys) manages the machine port. We could also use the below command to reverse the URL for the account runs the service.
https://learn.microsoft.com/en-us/dotnet/framework/wcf/feature-details/configuring-http-and-https
https://learn.microsoft.com/en-us/windows/desktop/http/add-urlacl
Feel free to let me know if there is anything I can help with.

how can I test a WCF service using XAMPP to work with Apache server?

I built a WCF service on a windows virtual machine, and tested it with the WCF test client by typing this on my browser:
http://localhost/Service1.svc/getAllCustomers
... and it works pretty good. Now the problem is that I want to do the same test in my real computer (not the VM).
I'm using XAMPP on the VM, I have set the project on the htdocs folder, and I type this on my browser:
http://10.211.55.3/WCFWebService/Service1.svc.cs/getAllCustomers
The problem is that it doesn't return the result of calling getAllCustomers, instead it returns the Service1.svc.cs in plain text.
I want it to do the same thing it does on the VM - can someone tell me what the problem is? I think it's because on the VM it works with the WCF test client, and since my computer is a Mac I can't run the WCF test client.
A WCF service can't run on an Apache web server instead you should install IIS Server on the VM in order to test the service.
Refer to this: http://msdn.microsoft.com/en-us/library/ms733766.aspx
I found this with a Google query.
I kept the tab open, but continued exploring the other search results.
One I found particularly interesting was this one: WCF acting as Web Service without IIS
It appears WCF gives options other than IIS to host the web service (Console Application, Windows Application, Windows Services).
The Windows Service link is provided here: How to: Host a WCF Service in a Managed Windows Service
I have not done this, so I cannot elaborate on what problems you will run into.
I just want others that may run into this (like I did) to know that the one answer posted last year may not actually be the end of the road.

Silverlight WCF service returns remote server not found error on deploy

I have been trying to host a WCF service for a Silverlight OOB application. When I run the application from my local machine it works fine. But when the same is deployed to a server, I get the following
Remote Server not found error.
I used fiddler to track the error and it says
HTTP/1.1 500 System.ServiceModel.ServiceActivationException
Could this be some issue with the IIS settings on the server?
You need to check two things,
1.Check for these two files in your service root folder clientaccesspolicy.xml and crossdomain.xml.
2.Check for the namespace of your service.you might be wrong on the namespace.
if these does not work post your web.config .

How do I configure Visual Studio to see a net.tcp URL on local IIS?

I've got a WCF service using the netTcpBinding, and no other binding. It works great when I manually deploy the files to IIS, and my client application can consume the service when I enter the net.tcp://localhost(etc) url. Now I'm trying to get the project to run in Visual Studio, so I can have the service and client in the same solution, and reference the service directly instead of going through IIS, and having to redeploy files manually.
Neither IIS Express nor the Visual Studio Development Server can use net.tcp, so they're out. In the Web tab of my service project, the "Use Local IIS Web Server" or "Use Custom Web Server" looked like good options, but neither of them will accept a URL that doesn't begin with http.
Is there some way of making my WCF service use IIS, and having my client reference the service directly (so that I don't have to deploy files to IIS, and then update service reference, every time I compile)?
Start the service in WcfSvcHost, then try to add a reference to the hosted URL.
Unfortunately, the VS IDE has no technique to start services automatically, except for when you're debugging.
Also, you always need to update service references explicitly. You need to decide which of your changes are ready to be applied to which clients of your service. It would be bad to assume that all clients should be updated as soon as you make a change then compile your service.
You could add a project, which you don't deploy, but only use during development, that self-hosts the service.

WCF Service doesnt run on IIS!

I have a WCF service hosted at local IIS. I created a ASP.NET website that consumes this service hosted at IIS.
While running it from Visual Studio WebDev Server, everything works fine, but as soon as i run the same website [after hosting in IIS] from the browser, the website doesnt seem to be communicating with the Service!
The same setup when runs from Visual Studio WebDev Server, doesnt function from IIS!
Any know isues?
Please help!
Thanks
I bet it's the address - when using Add Service Reference it will hardcode "localhost" into your ClientConfig file on the client.
Check this and implement a way to change over to your real (IIS) address at deploy time.
(A way to check you have the right deploy-time address is to pull it up in a browser, try navigating to "http://yoururl.com/MyService.svc" you should get a page that will link to the WSDL, letting you make sure you have the right address.. this is the address your client should look for)
Couple of things to check:
do you have a SVC file? Where is it located?
do you connect to the correct service address? It would be:
http://YourServerName/YourVirtualDirectory/YourServiceFile.svc
This is the address that you get when hosting in IIS - you cannot override that in your web.config, no matter how hard you try.
are the configurations for binding etc. identical on server and client?
have you turned on HttpGetEnabled for the service metadata? Can you navigate to the WSDL address and get the WSDL back??
http://YourServerName/YourVirtualDirectory/YourServiceFile.svc?wsdl
It sounds like you are not resetting the Service reference when you move it to the webserver. What you need to do after you have completed testing is to move your Service to be hosted by IIS, so deploy it to the server. Then you will need to re-reference, or update your reference in our web app before you deploy it.
Typically when testing your service it will run in the dev server at http://localhost:someport/myservice.svc
When you deploy it to IIS it will run on http://myserver.com/PossibleVDIR/myservice.svc
Once you take care of this you should be fine.