Page can’t be displayed on https - wcf

I got a WCF project that works in every computer in the company, but not on my pc.
I didn't wade any changes to the project.
Here is how the screen looks like after I run the project:
I can enter the site "http://localhost:52350/TSaveData.svc" and see the XML,
but when I'm trying to reach "https://localhost:44300/TSaveData.svc" I'm getting this screen:
Here is the properties window of the project:
Web config part:
<services>
<service name="WcfServiceSql.TSaveData" behaviorConfiguration="ServiceBehavior">
<endpoint name="soap" address="soap" binding="basicHttpBinding" contract="WcfServiceSql.ITSaveData" bindingConfiguration="BasicHttpBinding_ITSaveData">
It is in needed format, like:
<services>
<service name="[Namespace].[service class name]">
More information will be provided on your request.
Please help me to get data from https://localhost:44300/TSaveData.svc

Solution:
Reinstall the IIS Express.

Related

why changing wcf endpoint address in code seems doesn't work?

We have some really legacy wcf code and we got a strange problem:
WCFChartService.ChartServiceClient service = new WCFChartService.ChartServiceClient();
using (new OperationContextScope(service.InnerChannel))
{
service.Endpoint.Address = new System.ServiceModel.EndpointAddress(
"http://mypreprodsite.net/MyChartService.svc");
service.UpdateChartTemplate(
xxxx);
}
In web.config, we have:
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_IChartService" />
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://myprodsite.net/MyChartService.svc"
binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IChartService"
contract="WCFChartService.IChartService" name="BasicHttpBinding_IChartService" />
</client>
</system.serviceModel>
Above code throws some error, so I debugged this, and turned out if in my web.config I have this everything will be fine
<endpoint address="http://mypreprodsite.net/MyChartService.svc"
binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IChartService"
contract="WCFChartService.IChartService" name="BasicHttpBinding_IChartService" />
The function change in wcf has only been deployed to preprod site, so looks like in my testing project, changing url directly in service.Endpoint.Address doesn't work as I expected.
As I moved away from old wcf code years ago (only randomly got assigned to look this one), can someone explain why? If I set service.Endpoint.Address="localhost:8049/MyChartService.svc" and my local machine does get called, so I am rather confused.
There are two ways to specify endpoint addresses for a service in WCF. You can specify an absolute address for each endpoint associated with the service or you can provide a base address for the ServiceHost of a service and then specify an address for each endpoint associated with this service that is defined relative to this base address.
Here is the reference: Specifying an Endpoint Address.

"There was no endpoint listening at" issue with a IIS Hosted WCF Service consuming another web service

I have created a WCF service which is hosted in IIS and that tries to call another web service (3rd party) to return some data. When trying to connect the service fails with the following error:
There was no endpoint listening at https://xxx (3rd party ws) that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details.
And this is while, my service is up (i know from my echo method) and it works successfully if it is self hosted.
I have the whole and sections copied to the model of web.config exactly as it is for the self hosting test but something still is missing.
I have been through other similar problems reported but mine is little bit specific in that the service is kind-of hosting another one and that one is causing the issue.
I can try to exlain better with a real example:
There is a simple web service here: http://www.dneonline.com/calculator.asmx which I want to wrap inside our library and provide access to via an IIS hosted WCF.
So, a class library is created (Calculator project) to with one method, add to take two int arguments and use them to call the web service add method. The webservice is referenced as a Service Reference inside the library and is being addressed inside from within the config library app.config file like below:
<configuration>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="CalculatorSoap" />
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://www.dneonline.com/calculator.asmx"
binding="basicHttpBinding" bindingConfiguration="CalculatorSoap"
contract="Service.CalculatorSoap" name="CalculatorSoap" />
</client>
</system.serviceModel>
</configuration>
Then there is a WCF class library (CalcService project) which uses the first class library to enable http endpoints. Again, the app.config file includes endpoints both as for the service itself and as a client of the class library. The app.config file looks almost like this:
<configuration>
<system.serviceModel>
<services>
<service name="CalcService.Calc">
<host>
<baseAddresses>
<add baseAddress = "http://localhost:8733/Design_Time_Addresses/CalcService/Calc/" />
</baseAddresses>
</host>
<!-- Service Endpoints -->
<endpoint address="" binding="basicHttpBinding" contract="CalcService.ICalc">
<identity>
<dns value="localhost"/>
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
</service>
</services>
<!-- Client endpoint, i.e. to be able to use the calculator.asmx service addressed in the class library -->
<client>
<endpoint address="http://www.dneonline.com/calculator.asmx"
binding="basicHttpBinding"
contract="Service.CalculatorSoap" name="CalculatorSoap" />
</client>
<behaviors>
<serviceBehaviors>
<behavior>
<serviceMetadata httpGetEnabled="True" httpsGetEnabled="True"/>
<serviceDebug includeExceptionDetailInFaults="True" />
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
</configuration>
I am able to test the whole thing via a console application that makes a call to the WCF service and receives an answer. The console application config file has only one client endpoint to the WCF like below:
<configuration>
<system.serviceModel>
<client>
<endpoint address="http://localhost:8733/Design_Time_Addresses/CalcService/Calc/"
binding="basicHttpBinding" contract="Calculator.ICalc" name="BasicHttpBinding_ICalc" />
</client>
</system.serviceModel>
</configuration>
My question is now how I can host the WCF service inside IIS? I have tried different ways but neither one worked. My current IIS project (which doen't work) looks like this:
1-Has project references to both prevoius projects (Class Library and WCF Service) so two dll files are being added to the references:
CalcService.dll
Calculator.dll
2-Has a CalcService.svc file which creates a ServiceHost toward the CalcService:
<%# ServiceHost Language="C#" Debug="true" Service="CalcService.Calc"%>
3-Has a web.config with cliend endpoint to calculator.asmx:
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="CalculatorSoap" />
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://www.dneonline.com/calculator.asmx"
binding="basicHttpBinding" bindingConfiguration="CalculatorSoap"
contract="Service.CalculatorSoap" name="CalculatorSoap" />
</client>
<!-- some other settings -->
</system.serviceModel>
Now, when tested with a simple client to make a call to the calculator add method it fails with the following error:
There was no endpoint listening at http://www.dneonline.com/calculator.asmx that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details.
I don't know which message the endpoint is expecting, I could just assumed it has to be Service.CalculatorSoap as it worked before from the console application.
On the other hand, what confuses me is that a self hosted WCF also works (via http://localhost:8733/Design_Time_Addresses/CalcService/Calc/ from the config file in the WCF class library project).
I don't know what is missing here, is it something from the IIS configuration or permissions?
Or someting else like the windows firewall setting like explained in this post:
https://social.msdn.microsoft.com/Forums/vstudio/en-US/bec3ab7a-310e-415f-b538-6d5681e5e53c/there-was-no-endpoint-listening-at?forum=wcf
Just note that since I am using a company computer, I'm not able to shut down the firewall. I can just turn on/off some of the rules.
I hope it is clear now what we are after.
We tested the solution on a cloud based machine and it worked fine. In the end it looked to be some firewall rules blocking the IIS outgoing calls and nothing was wrong in the configuration files or in the code.

Absolute path is not working for WCF Service

I have a service file available in the following location.
C:\Documents and Settings\U16990\My Documents\Visual Studio 2010\Projects\CalculationService\CalculationService\CalculationService.svc
When I browse the svc file, it is working fine. The service endpoint is as listed below. It is currently a relative address used for address.
<service name="CalculationService.CalculationService" behaviorConfiguration="MyServiceTypeBehaviors">
<endpoint address="CalculationService" behaviorConfiguration=""
binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_CalculationServiceInterface"
contract="ICalculationService" />
</service>
IP address of my machine is 10.10.179.180 //InterNetwork AddressFamily
When I change the address to use absolute path it is throwing error:
<services>
<service name="CalculationService.CalculationService" behaviorConfiguration="MyServiceTypeBehaviors">
<endpoint
address="http://10.10.179.180/C:/Documents and Settings/U16990/My Documents/Visual Studio 2010/Projects/CalculationService/CalculationService/CalculationService.svc/CalculationService"
behaviorConfiguration=""
binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_CalculationServiceInterface"
contract="ICalculationService" />
</service>
</services>
Error:: No protocol binding matches the given address 'http://10.10.179.180/C:/Documents and Settings/U16990/My Documents/Visual Studio 2010/Projects/CalculationService/CalculationService/CalculationService.svc/CalculationService'. Protocol bindings are configured at the Site level in IIS or WAS configuration.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
What can we do to correct it?
Note: I am testing the service with Visual Studio 2010.
Reference:
Hosting a Simple Wcf Service in Console
error "No protocol binding matches the given address ..."
How to derive a website absolute file path from a WCF service hosted in IIS?
An endpoint address is not a location of a file, but the URI at which the client can/will find the service. You should probably use something like this:
<service name="CalculationService.CalculationService" behaviorConfiguration="MyServiceTypeBehaviors">
<endpoint
address="http://10.10.179.180/CalculationService/CalculationService.svc"
behaviorConfiguration="" binding="basicHttpBinding"
bindingConfiguration="BasicHttpBinding_CalculationServiceInterface"
contract="ICalculationService" />
</service>
In this case you're using a full URI instead of a relative one. In your client you must make sure that the endpoint refers to the same address, and you're good to go.

How to configure the IIS to support WCF service?

I wrote WCF service ( web service ).
I never work with the IIS - and i dont know if i need to change \ config something in the IIS to work with my service.
Someone can help me ?
Thanks
P.S: IIS version is 7.5
Hosting a service on an IIS Web server is very similar to hosting a traditional Web service (with an .asmx file extension).
Services hosted in IIS require the creation of a file with an .svc file extension. This is done for you automatically if you use the Visual Studio 2008/2010 WCF Service template. The Service.svc file is an XML-based file that must include an #ServiceHost directive.
<% #ServiceHost Language="C#" Service="EmployeeService" %>
in the web config you can leave the address attribute blank.
<services>
<service name="EmployeeService">
<clear />
<endpoint address="mex" binding="mexHttpBinding" name="mex" contract="IEmployeeService" />
<endpoint binding="wsHttpBinding" name="wsHttpBinding" contract="IEmployeeService" />
<endpoint binding="basicHttpBinding" name="basicHttpBinding" contract="IEmployeeService" />
</service>
</services>
For more info take a look at: http://msdn.microsoft.com/en-us/library/ms733766.aspx

WCF URL Question

I'm somewhat new to web development, so I'm unsure of the terminology to use here. I have a wcf web service that I've build for windows azure. I would like to have multiple endpoints that resolve to the same service, however I'm not entirely sure how to configure this.
This may help explain what I'm wanting a little better:
Currently, I have a service at https://myapp.cloudapp.net/service.svc
I would like to have the following url point to the same service in the application:
https://myapp.cloudapp.net/myapp/service.svc
I'm sure this is something easy to do, I just haven't been able to find a solution yet.
Edit:
I found this documentation on MSDN:
http://msdn.microsoft.com/en-us/library/ms734786.aspx
However, I can't seem to get it to work.
Here is is how my endpoint is defined in my web.config:
<services>
<service behaviorConfiguration="MetadataEnabled" name="myProject.myApp.myService">
<host>
<baseAddresses>
<add baseAddress="https://localhost/myService/" />
</baseAddresses>
</host>
<endpoint address="" binding="wsHttpBinding" bindingConfiguration="wsBinding" name="wsBase" contract="myProj.myApp.IServ" />
<endpoint address="mex" binding="mexHttpsBinding" bindingConfiguration="mexBinding" name="HttpMetadata" contract="IMetadataExchange" />
<endpoint address="myApp/" binding="wsHttpBinding" bindingConfiguration="wsBinding" name="WsPlain" contract="myProj.myApp.IServ" />
</service>
</services>
It's still not working, but hopefully it's getting close. Would love any suggestions!
I just found out the answer. I just needed to create a folder in the project "myApp", and make copy the .svc file (not the .svc.cs file) to that folder. This allowed the following to work:
myapp.cloudapp.net/service.svc
myapp.cloudapp.net/myapp/service.svc
This is trivial and probably you already do, but are you defining InputEndpoints in ServiceDefinition.csdef?
There's a WCF Routing Service that might be of use (or might be overkill).
See also Supporting Multiple IIS Site Bindings and Endpoint Addresses.