I am just starting to learn WCF. I have successfully set up a WCF service with host console app. The service maps to SQL Server with Entity Framework. I then have a WPF client app which consumes the service. This all works fine in Dev, both the service and client app running from my machine:
<endpoint address="http://localhost:8081/" binding="basicHttpBinding"
bindingConfiguration="BasicHttpBinding_IRegimesService" contract="RegimesService.IRegimesService"
name="BasicHttpBinding_IRegimesService" />
I have now transferred the service and host onto my new VM. The service host runs fine. I am now trying to configure the client app endpoint to connect to the service. I think the HTTP address is incorrect:
Service app.config:
<services>
<service name="diiRegimesService.RegimesService">
<endpoint address="" binding="basicHttpBinding" contract="diiRegimesService.IRegimesService"/>
<host>
<baseAddresses>
<add baseAddress="http://localhost:8082" />
</baseAddresses>
</host>
</service>
</services>
Client app.config:
<client>
<endpoint address="http://emea-myserver01.emea.basketballinfo.com/localhost:8082/" binding="basicHttpBinding"
bindingConfiguration="BasicHttpBinding_IRegimesService" contract="RegimesService.IRegimesService"
name="BasicHttpBinding_IRegimesService" />
</client>
The server credentials for remote desktop are: emea-myserver01.emea.basketballinfo.com
I currently don't specify a username & password in my client app.config.
The service is running on the server. I'm getting an exception trying to add the service reference in the client app.
Add Service Reference- Adress: http://EMEA-myserver01.emea.basketballinfo.com
The request failed with HTTP status 404: Not Found.
Metadata contains a reference that cannot be resolved: 'http://emea-myserver01.emea.basketballinfo.com/'.
You need to make sure the server is able to resolve the full domain name.
Also, the address url provided in the client configuration snippet <endpoint address="http://emea-myserver01.emea.basketballinfo.com/localhost:8082/ does not seem valid. Perhaps you want to use <endpoint address="http://emea-myserver01.emea.basketballinfo.com:8082/
Related
Trying to deploy a super barebones WCF Web Service and test it locally. I'm getting an error:
Could not find a base address that matches scheme https for the endpoint
with binding BasicHttpBinding. Registered base address schemes are [http].
I'll include my endpoint tags from the web.config file here:
<services>
<service name="Company.PrototypeWebService.PrototypeWebService">
<endpoint address="" binding="basicHttpBinding" bindingConfiguration="secureHTTPBinding" contract="Company.PrototypeWebService.ServiceContracts.IPrototypeWebService" />
<endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange"/>
</service>
</services>
Is there something I'm missing here? I'm new to web service development.
This is because your base address is Http, but I see that your metadata endpoint uses https, which is the cause of the error,modify your Service:
<services>
<service name="Company.PrototypeWebService.PrototypeWebService">
<endpoint address="" binding="basicHttpBinding" bindingConfiguration="secureHTTPBinding" contract="Company.PrototypeWebService.ServiceContracts.IPrototypeWebService" />
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
</service>
</services>
Modify mexHttpsBinding to mexHttpBinding.
If you want to use https binding, you need to configure the SSL certificate on the server. Normally, it is more convenient to use https in IIS.
UPDATE
If hosted in IIS, we need to create the following WCF project:
The directory of this project looks like this:
We can deploy the project directly to IIS, set the base address when deploying in IIS, we do not need to configure the base address in the configuration file. This is the base address of the service:
After the deployment is successful, we click on the .svc file to view the service:
I am running into issues while trying to run a WCF REST service that will connect to an Azure Service bus. My web.config contains the following:
<system.serviceModel>
<services>
<service name="helloSB.SomeService">
<endpoint contract="helloSB.ISomeService"
binding="webHttpRelayBinding"
address = "" />
<host>
<baseAddresses>
<add baseAddress="http://localhost:7200/mySB/helloSB.SomeService/" />
</baseAddresses>
</host>
Whenever I try to send a message to WCF, I receive:
The service /mySB/SomeService.svc cannot be activated due to an exception during compilation. The exception is : Unable to reach localhost via TCP (9351, 9352) or HTTP (80,443).
Why can't I use a non-standard port?
Looks like these are related to some port issues. The below link provides additional details on troubleshooting steps.
http://social.technet.microsoft.com/wiki/contents/articles/2055.troubleshooting-connectivity-issues-in-the-azure-appfabric-service-bus.aspx
After implemeting a WCF service, hosting it on the IIS Server, it returned with the below error.
EndpointNotFoundException was unhandled by user code There was no
endpoint listening at XXXXX that could accept the message. This is
often caused by an incorrect address or SOAP action. See
InnerException, if present, for more details.
That service is identically has the same implementation and configuration of 5 running services with no errors.
when I tried to figure out what is going on the IIS server, the below screenshot.
So it seems that this specific service has no detected Contract. although I'm using the same configuration as below.
<service name="XX.XX.Provisioning.EldaftarManagementService">
<endpoint address="" binding="customBinding" bindingConfiguration="ProvisioningServiceBinding" bindingNamespace="http://XX.XX.com/XX/" contract="XX.XX.Provisioning.Eldaftar.IEldaftarManagementService" />
<endpoint address="basic" binding="basicHttpBinding" bindingConfiguration="ProvisioningBasicBinding" bindingNamespace="http://XX.XX.com/provisioning/" contract="XX.XX.Provisioning.Eldaftar.IEldaftarManagementService" />
</service>
<service name="XX.XX.Provisioning.Common.UserManagement.UserManagementService">
<endpoint address="" binding="customBinding" bindingConfiguration="ProvisioningServiceBinding" bindingNamespace="http://XX.XX.com/XX/" contract="XX.XX.Provisioning.Common.UserManagement.IUserManagementService" />
<endpoint address="basic" binding="basicHttpBinding" bindingConfiguration="ProvisioningBasicBinding" bindingNamespace="http://XX.XX.com/provisioning/" contract="XX.XX.Provisioning.Common.UserManagement.IUserManagementService" />
</service>
Kindly noted that when accessing the service.svc url it replies normally and the wsdl is shown. So that means it's hosted fine on the IIS.
Do I miss something?
Update:
Client config.
<endpoint address="https://XXX/EldaftarManagementService.svc" behaviorConfiguration="ProvisioningClientBehaviour" binding="customBinding" bindingConfiguration="ProvisioningServiceBinding" contract="EldaftarManagementService.IEldaftarManagementService" />
<endpoint address="https://XXX/UserManagement.svc" behaviorConfiguration="ProvisioningClientBehaviour" binding="customBinding" bindingConfiguration="ProvisioningServiceBinding" contract="UserManagementService.IUserManagementService" />
i notice sometime after reconfigure my service reference, the client config getting wsdl with server name. then i get EndpointNotFoundException exception.
example :
service reference is : http://192.168.61.2:1111/Service1.svc
but in the config endpoint address it show : http://serverName:1111/Service1.svc
After i change the config endpoint address with the service reference address , then it resolved. Not sure why but now every time when i reconfigure the endpoint address, i will manually change the config endpoint address to make sure it get the same address.
How do I get all the wcf 4.0 service addresses from each project in the Visual Studio solution when the services section endpoints in the web configs don’t specify an address or baseaddress? I intend to write the list of service addresses out to an aspx page. Any help would be appreciated.
Here's an example of one of the service sections in the web config.
<services>
<service name="ABC.Enterprise.Flight.FlightService">
<endpoint address="" binding="basicHttpBinding" name="ICRMManagement" contract="ABC.Enterprise.Flight.IFlightService"/>
<endpoint address="MexBasic" binding="mexHttpBinding" name="MexBasic" contract="IMetadataExchange" />
</service>
You could use WCF Discovery to find endpoints at runtime...
http://msdn.microsoft.com/en-us/library/dd456791.aspx
I am connecting a solution to a WCF SOAP based web service. The URL is in the format:
http://upload.pete.vls.com/api/hmlapi.svc
However when I add the reference the configuration comes up with the following:
<client>
<endpoint address="http://upload.pete.vls.com/api/HmlApi.svc/soap"
binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IHmlApi"
contract="ServiceReference1.IHmlApi" name="BasicHttpBinding_IHmlApi" />
</client>
Im confused as to why when I add the reference with /soap/ on the end it doesnt work. But when I dont add it, the 'add reference' feature finds the service and adds it with a /soap/ anyway.
The URL you are entering (without the soap part) includes information on what types of service transport are offered. VS is choosing soap from that, and saving the proper endpoint address in the config.
That end URL would not be correct for what is being asked for when you are prompted, though. Because it's expecting a URL with information on the service - not the actual endpoint that will eventually get used.
Because your endpoint on the server is probably configured like that
<services>
<service name="YourService">
<endpoint name="mySOAPEndpoint" address="soap" binding="someHttpBinding" contract="IYourService" />
</service>
</services>
Note that the address is "soap" which is the relative path after your service URI (i.e. after the .svc). If you write address="" then your .svc URI is the same as your endpoint address.