Why Am I Unable To Connect To a WCF Service From SoapUI? - wcf

I created a sample WCFservice that provides four really simple services from 1 endpoint. Works fine within Visual Studio's (2010) WCF Test Client.
I was able to import the binding into SoapUI (4.5.2) and generate tests by referencing the wsdl. However when i execute any test i get a timeout.
Keep in mind that the service is only running on localhost via visual studio. But i can access the wsdl so i think it should be able to execute the tests. I keep getting timeouts and never hit service-side breakpoints.
Here's the endpoint i use in soapui
http://127.0.0.1:8732/Design_Time_Addresses/WcfMathServLib/MathService/
Looks like WCF Test Client uses this:
http://127.0.0.1:8732/Design_Time_Addresses/WcfMathServLib/MathService/mex
But neither really works for me. Any ideas?

Related

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.

Need guidance in calling WCF service from Silverlight 4

Okay guys, I call upon your combined intellects. I have a web application with a silverlight app that calls a ria service. The ria service is defined inside the web application and everything else is just dandy.
The issue is this.
It is my understanding that in order for the silverlight application to talk and know what the ria service is, you need to add a service reference for that service. The service reference defines the ria service and sets up the connection binding. One of the files it adds is the ServiceReference.ClientConfig which has the connection binding in it. During the course of this application's development, this is the way it was set up. And it worked perfectly fine locally and on the dev server.
Unfortunately there were issues when deploying to the clients in-house server. At this point I was onto other projects while my co-worker continued with the deployment. He soon became frustrated with the goofy errors that were occurring and recruited some help. This dev came in and, albeit got it working, but in order to do so he removed the service reference from the silverlight project but left the ServiceReference.ClientConfig which pointed to the location of the service in the web application(but that's it, no definition or explanation as to what the service does and I'm not sure how the silverlight app is supposed to know how to work with it..). This works perfect on my co-workers workstation and he has deployed this version to the clients server fine.
When I open the project it doesn't run at all. And the reason why is that it doesn't know what the service is that i'm using in code. Specifically, it doesn't know where this is (names changed for clarification):
Imports SilverlightApp.ServiceReference.WebApp.Service
I have cleaned the solution, completely deleted and got the latest from source control, built the web app first and made sure the asp.net dev server was running so that the address in the ServiceReference.ClientConfig resolved correctly. But, alas, it still doesn't know what Imports SilverlightApp.ServiceReference.WebApp.Service is.
So, to get it working on my workstation, I added the ServiceReference back but kept the current connection bindings so that it matched the endpoint in the web app web config. and changed the import statement to Imports SilverlightApp.ServiceReference and everything works fine.
What is the reason for this insanity?!?!
All the things you are talking about relate to a WCF service NOT a WCF RIA Service. They work in quite different ways when consuming them in your client app.
A WCF service will require a service reference and the ServiceReference.ClientConfig.
A WCF RIA Service does not. The link to the WCF RIA service is set in the silverlight project properties in the Silverlight tab at the bottom. When you build it will generate client side context code in the Generated_Code folder. Show all files and you will see it.
Hope that helps?
Kevin

Delphi7 client connecting to WCF service

I have a WCF service and 2 clients I'm testing with. The first client is written in c# .NET 3.5 and has no trouble connecting to the WCF service. The other client is written in Delphi7, and it's the one I'm interested in getting working. This is the interesting part. If I start the service then hit it with the Delphi client, it won't connect... but if I start the service then hit it with the .Net client then try the Delphi client, it works ! Could be something to do with the design-time addresses, I'm not sure. Maybe a more experienced person will know what's going on and what I need to do to get my Delphi client working without needing a .Net client running alongside it. It might be relevant to note that the service is currently being hosted in a winforms app.
regenerating the wsdl and re-importing it into Delphi 7 seems to fix it.

Unit testing of WCF webservice with Gallio/MbUnit

I have a WCF service with a simple Gallio unit test that calls the service. However, I am confused by the framework's behavior. When I start visual studio for the first time, and try to run the unit test, I get the following error:
System.ServiceModel.EndpointNotFoundException: There was no endpoint listening at http://localhost:43671/MyService.svc/MyService that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details. ---> System.Net.WebException: Unable to connect to the remote server ---> System.Net.Sockets.SocketException: No connection could be made because the target machine actively refused it 127.0.0.1:43671
ErrorCode: 10061
However, if I right click on the Service Reference in the unit test project and do "Update service reference", a popup saying that ASP.NET Development server on port 43671 has been started shows up, and the unit test works fine.
How do I add the server start up code to my unit test so I don't have to "Update service reference" every time I want to run a unit test?
Thanks.
This happens because your WCF service host is not started when you run visual studio. Once you try to update the service reference Visual Studio automatically starts the WCF service host and after that your services will be accessible.
One way to solve this problem is to host your service(s) in IIS. This will ensure that the services will be accessible even if VS is not running.
Other solution would be to add reference (assembly reference) to your service and instantiate the service class directly. You don't need to have the service running to run unit tests against it. So if you have a service class called SomeServiceClass you could create an instance of this class in your unit tests (SomeServiceClass instance = new SomeServiceClass()) and write your asserts against it (without even hosting the service).
You can self host a service using ServiceHost. If you use that in the startup code of your unit tests, the WCF service will be hosted in the unit test.
I'm not sure where the app.config is for the unit tests you are hosting. However, you can always run the service in a separate AppDomain and set the AppDOmainSetup.ConfigurationFile

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

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.