Could not find a base address that matches scheme https. wcf on visual studio localhost - asp.net

I am trying to use wcf on both https and http.
I manage to config the web.config to work on the server both http and https.
the problem is that wcf not working on the visual studio localhost(doesn't have ssl).
the web.config look like this
<webHttpBinding>
<binding name="webBinding">
<security mode="Transport">
</security>
</binding>
<binding name="webBindingNotSecure">
<security mode="None">
</security>
</binding>
</webHttpBinding>
and then 2 endpoint for http and https:
<service name="Website.WebServices.ddPoplute">
<endpoint behaviorConfiguration="Website.WebServices.ddPopluteAspNetAjaxBehavior"
binding="webHttpBinding" bindingConfiguration="webBinding" contract="Website.WebServices.ddPoplute">
</endpoint>
<endpoint behaviorConfiguration="Website.WebServices.ddPopluteAspNetAjaxBehavior"
binding="webHttpBinding" bindingConfiguration="webBindingNotSecure" contract="Website.WebServices.ddPoplute" />
</service>
as mention above in the server that has https everything just fine, but on localhost that doesn't have the ssl I am getting error:
Could not find a base address that matches scheme https for the endpoint with binding WebHttpBinding. Registered base address schemes are [http]
If I delete the endpoint with security mode="Transport" the wcf work on the localhost but not on https(in server).
ant idea what to do?
Thnaks
Baaroz

visual studio doesn't support https and ssl and the error return because the protocol doesn't exist.
for solving the problem you should install iis express and use it in visual studio.
check here for learn how to use iis express
http://joel.net/setting-up-visual-studio-2010-and-iis-express

Related

How to start 2660 port in IIS for Tridion Core Service connection using netTcp

I am trying to connect to Tridion using core service script, here is my code:
public static SessionAwareCoreServiceClient Client;
Client = new SessionAwareCoreServiceClient("netTcp_2011");
Client.ClientCredentials.Windows.ClientCredential = new NetworkCredential(user, password);
web.Config has following:
<system.serviceModel>
<!-- Default/example WCF settings for Core Service. These settings should be copied into the host application's configuration file. -->
<bindings>
<!-- Default Core Service binding settings are provided here. These can be used as a starting point for further customizations. -->
<basicHttpBinding>
<binding name="basicHttp" maxReceivedMessageSize="10485760">
<readerQuotas maxStringContentLength="10485760" maxArrayLength="10485760"/>
<security mode="TransportCredentialOnly">
<!-- For LDAP or SSO authentication of transport credentials, use clientCredentialType="Basic" -->
<transport clientCredentialType="Windows"/>
</security>
</binding>
<binding name="streamDownload_basicHttp" maxReceivedMessageSize="209715200" transferMode="StreamedResponse" messageEncoding="Mtom" sendTimeout="00:15:00">
<security mode="TransportCredentialOnly">
<!-- For LDAP or SSO authentication of transport credentials, use clientCredentialType="Basic" -->
<transport clientCredentialType="Windows"/>
</security>
</binding>
<binding name="streamUpload_basicHttp" maxReceivedMessageSize="209715200" transferMode="StreamedRequest" messageEncoding="Mtom" receiveTimeout="00:15:00">
<security mode="None"/>
</binding>
</basicHttpBinding>
<netTcpBinding>
<binding name="netTcp" transactionFlow="true" transactionProtocol="WSAtomicTransaction11" maxReceivedMessageSize="2147483647">
<readerQuotas maxStringContentLength="2147483647" maxArrayLength="2147483647"/>
</binding>
<binding name="streamDownload_netTcp" maxReceivedMessageSize="2147483647" transferMode="StreamedResponse" sendTimeout="00:20:00"/>
<binding name="streamUpload_netTcp" maxReceivedMessageSize="2147483647" transferMode="StreamedRequest" receiveTimeout="00:20:00"/>
</netTcpBinding>
</bindings>
<client>
<!--Dev 2013 -->
<endpoint name="netTcp_2011" address="net.tcp://localhost:2660/CoreService/2011/netTcp" binding="netTcpBinding" bindingConfiguration="netTcp" contract="Tridion.ContentManager.CoreService.Client.ISessionAwareCoreService"/>
<endpoint name="streamDownload_netTcp_2011" address="net.tcp://localhost:2660/CoreService/2011/streamDownload_netTcp" binding="netTcpBinding" bindingConfiguration="streamDownload_netTcp" contract="Tridion.ContentManager.CoreService.Client.IStreamDownload"/>
<endpoint name="streamUpload_netTcp_2011" address="net.tcp://localhost:2660/CoreService/2011/streamUpload_netTcp" binding="netTcpBinding" bindingConfiguration="streamUpload_netTcp" contract="Tridion.ContentManager.CoreService.Client.IStreamUpload"/>
<!-- -->
</client>
</system.serviceModel>
Still I get this Error:
Could not connect to net.tcp://localhost:2660/CoreService/2011/netTcp. The connection attempt lasted for a time span of 00:00:01.0520000. TCP error code 10061: No connection could be made because the target machine actively refused it localhost:2660.
Note: localhost can also be an IP of a CMS instance.
Can anyone help?
Okay, so Over the time I educated myself and can clearly say that the error target machine actively refused it localhost:2660 clearly says that the port is not open for you to use.
So do these two things to be sure:
Make sure you have allowed net.tcp in IIS
And the port 2660 open in the windows firewall?
run a netstat -tan to see whether anything is running on 2660, if not then you can not access it.
Also If you are running your code form local system or from another server, in case netTcp is not working, try to use wsHttp or BasicHttp (provided you have these bindings in your server core service's web.config)
The Core Service runs as a Windows Service, not from IIS. Open Windows Services and make sure that the Tridion Content Manager Service Host is running.

Web Service Error "There was no endpoint listening at..." Firewall Concern

So I have a web service service reference that works localhost and can be pinged from its production url but I can't get access to it via the Service Reference call in production. I believe the issue is my firewall . I have two websites on the same server each with their own dedicated IP address. I am trying to call the web service on the second website from the first website. If I open a browser on my production server I cannot navigate to either website.
Error Description:There was no endpoint listening at http://[209.112.245.103]/Services/OfferService.asmx that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details.
Inner Exception:Unable to connect to the remote server
The calling website is on the same server (different IP of course) and is calling the web service via a service reference:
Dim offerService As New ServiceReferenceOffer.OfferServiceSoapClient("OfferServiceSoap")
offerService.BroadcastOfferChange(offer.PropertyID, offer.OfferID, offer.ResultResponse)
And my web.config contains the following service endpoint information:
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="OfferServiceSoap" />
<binding name="ConversationServiceSoap" />
</basicHttpBinding>
<customBinding>
<binding name="OfferServiceSoap12">
<textMessageEncoding messageVersion="Soap12" />
<httpTransport />
</binding>
<binding name="ConversationServiceSoap12">
<textMessageEncoding messageVersion="Soap12" />
<httpTransport />
</binding>
</customBinding>
</bindings>
<client>
<endpoint address="http://209.112.245.103/Services/ConversationService.asmx"
binding="basicHttpBinding" bindingConfiguration="ConversationServiceSoap"
contract="ServiceReferenceConversation.ConversationServiceSoap"
name="ConversationServiceSoap" />
<endpoint address="http://209.112.245.103/Services/ConversationService.asmx"
binding="customBinding" bindingConfiguration="ConversationServiceSoap12"
contract="ServiceReferenceConversation.ConversationServiceSoap"
name="ConversationServiceSoap12" />
<endpoint address="http://209.112.245.103/Services/OfferService.asmx"
binding="basicHttpBinding" bindingConfiguration="OfferServiceSoap"
contract="ServiceReferenceOffer.OfferServiceSoap" name="OfferServiceSoap" />
<endpoint address="http://209.112.245.103/Services/OfferService.asmx"
binding="customBinding" bindingConfiguration="OfferServiceSoap12"
contract="ServiceReferenceOffer.OfferServiceSoap" name="OfferServiceSoap12" />
</client>
</system.serviceModel>
Your configurations are correct. I just accessed your server and everything went fine (so it's not code related).
Since the site and the website are in the same server, you may need to use a different IP or address to access the wcf (try 127.0.0.1, localhost or an internal server ip).

Error on Silverlight WCF access via https

From my silverlight 4.0 application. I can access the WCF File easily but when moved to https, I can't access the WCF Service. The error details are following:
An unknown error occurred. Please contact your system Administrator for more information.
An exception occurred during the operation, making the result invalid. Check InnerException for exception details.
at System.ComponentModel.AsyncCompletedEventArgs.RaiseExceptionIfNecessary()
at FileSearch.SearchServices.GetTypeofFileDetailedCompletedEventArgs.get_Result()
at FileSearch.Home.<SearchButton_Click>b__0(Object s, GetTypeofFileDetailedCompletedEventArgs ea)
at FileSearch.SearchServices.SearchServiceClient.OnGetTypeofFileDetailedCompleted(Object state)
I have seen different posts regarding this issue, but nothing is pointing me in a proper direction.
Here are the details regarding my web.config file for the web application that hosts the silverlight application as well as the WCF Service.
<services>
<service name="FileSearch.Web.Services.SearchService">
<endpoint address="" binding="customBinding" bindingConfiguration="FileSearch.Web.Services.SearchService.customBinding0" contract="FileSearch.Web.Services.SearchService" />
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
</services>
and here is the servicerefernce.clientconfig file:
<configuration>
<system.serviceModel>
<bindings>
<customBinding>
<binding name="CustomBinding_SearchService">
<binaryMessageEncoding />
<httpTransport maxReceivedMessageSize="2147483647" maxBufferSize="2147483647" />
</binding>
</customBinding>
</bindings>
<client>
<endpoint address="../Services/SearchService.svc"
binding="customBinding" bindingConfiguration="CustomBinding_SearchService"
contract="SearchServices.SearchService" name="CustomBinding_SearchService" />
</client>
</system.serviceModel>
</configuration>
UPDATE:
I've received answers to run the service in the https mode only. I want to run the service in both http and https modes.
any ideas regarding this ?
Specify two endpoints one with secured transport and one without it.
try adding
<security mode="Transport" />
in you service config file. this should be nested inside the binding node.
Check out the security mode configuration section in this article.
For supporting Https scheme, you'd need to change transport to <httpsTransport>. I see you're using <httpTransport>.

Configuring WCF/NET.TCP on IIS 7, "Unknown" next to net.tcp status?

I've tried this on two machines and can't figure it out. I've followed the instructions here (http://msdn.microsoft.com/en-us/library/ms731053.aspx) and ensured that the TCP listener service is running. However, next to the site application, I see "Unknown (net.tcp)" as the status.
For enabled protocols in IIS, they are listed as "http,net.tcp". My binding for net.tcp is "808:*" and the app pool is .NET 4.0 integrated. Let me know what information I can provide.
Also, when trying to connect, it says it cannot connect to the mex endpoint. My service endpoint code is below. Any help is appreciated. Thanks.
<system.serviceModel>
<services>
<service name="Sandbox.ClientSideWCF.Service">
<host>
<baseAddresses>
<add baseAddress="net.tcp://localhost:808/service.svc" />
</baseAddresses>
</host>
<endpoint name="TcpEndpoint" address="" contract="Sandbox.ClientSideWCF.IService" binding="netTcpBinding" />
<endpoint name="MetaInfo" contract="IMetadataExchange" binding="netTcpBinding" address="mex" />
</service>
</services>
....
</system.ServiceModel>
The < baseAddresses > element is for self-hosted services. See here:
http://msdn.microsoft.com/en-us/library/ms788995.aspx
Try removing it. Also see this link How to: Host a WCF Service in WAS:
http://msdn.microsoft.com/en-us/library/ms733109.aspx
I think I figured it out. The problem was that I didn't include a service behavior. I added an empty behavior and it worked. I didn't know this was required.

IIS Hosted WCF Service won't accept https endpoint, receive 404 resource error

Despite all of my efforts, I have not been able to get my simple WCF service hosted on IIS with SSL.
We are using windows server 2k3 with IIS 6.0 and we have up to .NET 4.0 installed on the server (web site is configured for 4.0)
If i go to http//.../rptService.svc url, I get the .svc page with the code blocks and ?wsdl url
on the other hand, if i go to https//.../rptService.svc I get a "Resource not found" 404 error. (colons on urls are removed b/c of spam prevention)
The web site has a working SSL certificate enabled for it.
My relevant web.config file is as follows:
<system.serviceModel>
<bindings>
<wsHttpBinding>
<binding name="rptBinding">
<security mode="Transport">
<transport clientCredentialType="None"/>
</security>
</binding>
</wsHttpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior name="wcfApp.rptServiceBehavior">
<serviceDebug includeExceptionDetailInFaults="true"/>
<serviceMetadata httpsGetEnabled="false" httpGetEnabled="true" />
<serviceTimeouts/>
</behavior>
</serviceBehaviors>
</behaviors>
<services>
<service behaviorConfiguration="wcfApp.rptServiceBehavior"
name="wcfApp.rptService">
<endpoint binding="wsHttpBinding" bindingConfiguration="rptBinding" contract="wcfApp.rptService"
address="">
</endpoint>
<endpoint name="MetadataBinding" address="mex" binding="mexHttpsBinding" contract="IMetadataExchange" />
</service>
</services>
I have tried just about 100 different ways to write the web.config file from 150 different blog/web posts with similar situations, and have not gotten anything to work thus far.
My end goal is to get this wcf service hosted accepting a username/password token with a custom user name validator, but right now I can't even get it working with SSL!
Application is being built in VS 2010.
Please let me know if there is any more information that I can provide.
Any help is appreciated!

Resources