I hosted one WCF service on server
http://firstdomain.com/WebStorePrice/PickStorePrice.svc
which was running on my machine. Now i hosted this to new server as azure service and when trying to add Service reference i am getting the error
There was an error downloading 'https://service.azurewebsites.net/PickStorePrice.svc/$metadata'.
The request failed with HTTP status 404: Not Found.
Metadata contains a reference that cannot be resolved: 'https://service.azurewebsites.net/PickStorePrice.svc'.
There was no endpoint listening at https://service.azurewebsites.net/PickStorePrice.svc that could accept the message.
This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details.
The remote server returned an error: (404) Not Found.
If the service is defined in the current solution, try building the solution and adding the service reference again.
webconfig of wcf service looks like
<system.serviceModel>
<services>
<service name="WebStorePrice.PickStorePrice" behaviorConfiguration="cstmServiceConfig">
<endpoint address="" binding="basicHttpBinding" contract="WebStorePrice.IPickStorePrice"/>
</service>
</services>
<bindings>
<webHttpBinding>
<binding name="secure">
<security mode="Transport">
<transport clientCredentialType="Basic"/>
</security>
</binding>
</webHttpBinding>
</bindings>
<behaviors>
<endpointBehaviors>
<behavior name="cstmendpointConfig">
<webHttp/>
</behavior>
</endpointBehaviors>
<serviceBehaviors>
<behavior name="cstmServiceConfigOnline">
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
<behavior name="cstmServiceConfig">
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" aspNetCompatibilityEnabled="true"/>
</system.serviceModel>
From the service configuration, our service doesn’t support Https protocol since Azure docker(Paas)server communicates over Https by default. Therefore we should configure an extra service endpoint for supporting WCF over https.
For Soap style web service, please refer to the below configuration.
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior>
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
</behaviors>
<protocolMapping>
<add binding="basicHttpsBinding" scheme="https"/>
<add binding="basicHttpBinding" scheme="http"/>
</protocolMapping>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
</system.serviceModel>
In regard to WCF Restful style service.
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior>
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior>
<webHttp />
</behavior>
</endpointBehaviors>
</behaviors>
<bindings>
<webHttpBinding>
<binding name="mybinding">
<security mode="Transport">
<transport clientCredentialType="None"></transport>
</security>
</binding>
</webHttpBinding>
</bindings>
<protocolMapping>
<add binding="webHttpBinding" scheme="http"/>
<add binding="webHttpBinding" scheme="https" bindingConfiguration="mybinding"/>
</protocolMapping>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
</system.serviceModel>
Feel free to let me know if the problem still exists.
Related
I am using Plesk for hosting my wcf service.
Getting an error of not found while host , although my service is working fine on my local iis .
This is error which i am facing while accessing my service from Plesk server
This is how my service is running on my local iis
below is myservice web configuration. referencing for endpoints.
<system.serviceModel>
<services>
<service name="ExploreQuranRestService.QuranService" behaviorConfiguration="serviceBehavior">
<!-- Service Endpoints -->
<endpoint address="customBinding" binding="customBinding" bindingConfiguration="basicConfig" contract="ExploreQuranRestService.IQuranServiceK" />
<endpoint address="" binding="webHttpBinding" behaviorConfiguration="REST" contract="ExploreQuranRestService.IQuranServiceK" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="serviceBehavior">
<serviceMetadata httpsGetEnabled="true" httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name="REST">
<webHttp />
</behavior>
</endpointBehaviors>
</behaviors>
<bindings>
<customBinding>
<binding name="basicConfig">
<binaryMessageEncoding />
<httpTransport transferMode="Streamed" maxReceivedMessageSize="67108864" />
</binding>
</customBinding>
</bindings>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
</system.serviceModel>
I have to make a WCF service in visual studio 2015 MVC and it needs to be accesible only by SSL certificate, I´m using IIS (in Windows10) and trying to limit SSL for only this service (stored in a specifc folder).
When I change IIS option of this folder to "require SSL" the service said that "the http request is unauthorized with client authentication scheme 'anonymous'"
I changed web.config too, maybe something is bad there, the service´s name is EncServiceSSL
How can I do it?
WEB.config:
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior name="">
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
<behavior name="ServiceCredentialsBehavior">
<serviceMetadata httpGetEnabled="false" httpsGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false" />
<serviceAuthorization serviceAuthorizationManagerType="MyNamespace.ClientCertificateValidator, MyAssembly">
<authorizationPolicies>
<add policyType="MyNamespace.AdamAuthorizationPolicy, MyAssembly" />
</authorizationPolicies>
</serviceAuthorization>
<serviceCredentials>
<serviceCertificate findValue="1234xx" x509FindType="FindBySubjectName" storeLocation="LocalMachine" storeName="Root"/>
<clientCertificate>
<authentication certificateValidationMode="PeerTrust" trustedStoreLocation="LocalMachine" />
</clientCertificate>
</serviceCredentials>
<useRequestHeadersForMetadataAddress>
<defaultPorts>
<add scheme="https" port="443"/>
</defaultPorts>
</useRequestHeadersForMetadataAddress>
</behavior>
</serviceBehaviors>
</behaviors>
<services>
<service behaviorConfiguration="ServiceCredentialsBehavior" name="System.Web.ApplicationServices.AuthenticationService">
<endpoint address="http://localhost:8111/ServicesSSL/EncServiceSSL"
binding="wsHttpBinding"
bindingConfiguration="QuoteService"
name="SecuredByClientCertificate"
contract="encelogistica.QuoteServiceReference.QuoteServiceSoapChannel" />
</service>
</services>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
<bindings>
<basicHttpBinding>
<binding name="QuoteService">
<security mode="Transport">
<transport clientCredentialType="Windows" />
</security>
</binding>
<binding name="QuoteServiceSoap" />
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://localhost:8111/ServicesSSL/EncServiceSSL.asmx"
binding="basicHttpBinding" bindingConfiguration="QuoteServiceSoap"
contract="QuoteServiceReference.QuoteServiceSoap" name="QuoteServiceSoap" />
</client>
</system.serviceModel>
</configuration>
Currently our services use Message level security, but as we are using Soap UI for testing. After many hours, we discovered that Soap UI is not good with Message level security, something to do with java core I believe.
Have tried to unravel the web.config to use Transport level security, which I believe is supported by Soap UI, but as soon as I change the security mode to Transport I get the following error:
Could not find a base address that matches scheme https for the endpoint with binding WSHttpBinding. Registered base address schemes are [http].
Can someone have a look at the config as I am sure that I have missed something.
<system.serviceModel>
<services>
<service name="MyService"
behaviorConfiguration="ServiceBehavior">
<endpoint address=""
binding="wsHttpBinding"
bindingConfiguration="ServiceWsHttpBinding"
name="ClaimServiceHttpEndpoint"
contract="IMyService" />
<endpoint address="mex"
binding="mexHttpBinding"
contract="IMetadataExchange" />
</service>
</services>
<bindings>
<wsHttpBinding>
<binding name="ServiceWsHttpBinding"
maxBufferPoolSize="2147483647"
maxReceivedMessageSize="2147483647">
<readerQuotas maxDepth="2000000"
maxStringContentLength="2147483647"
maxArrayLength="2147483647"
maxBytesPerRead="2147483647"
maxNameTableCharCount="2147483647" />
<security mode="Message">
<message clientCredentialType="UserName"
negotiateServiceCredential="false"
establishSecurityContext="false" />
</security>
</binding>
</wsHttpBinding>
</bindings>
<behaviors>
<endpointBehaviors>
<behavior name="ClientEndpointBehavior">
<clientCredentials>
<serviceCertificate>
<authentication certificateValidationMode="None" />
</serviceCertificate>
</clientCredentials>
</behavior>
</endpointBehaviors>
<serviceBehaviors>
<behavior name="ServiceBehavior">
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="false" />
<serviceDebug includeExceptionDetailInFaults="true" />
<serviceCredentials>
<serviceCertificate findValue="CN=test.service.com"
storeLocation="LocalMachine"
storeName="My"
x509FindType="FindBySubjectDistinguishedName" />
<userNameAuthentication userNamePasswordValidationMode="Custom"
customUserNamePasswordValidatorType="MyObject.UserAuthentication, MyObject.Utils" />
</serviceCredentials>
<serviceAuthorization principalPermissionMode="Custom">
<authorizationPolicies>
<add policyType="MyObject.Utils.AuthPolicy, Myobject.Utils" />
</authorizationPolicies>
</serviceAuthorization>
</behavior>
<behavior name="">
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
</behaviors>
<protocolMapping>
<add binding="basicHttpsBinding" scheme="https" />
</protocolMapping>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
I have a WCF REST service that has to accept a raw input stream from a client. In order to receive the raw stream, I'm using a custom binding in my web.config file. The service works fine if I set it to connect over standard HTTP. However, I'm having difficulty getting it to work over HTTPS.
Manual addressing is not supported with message level security. Configure the binding ('CustomBinding', 'http://tempuri.org/') to use transport security or to not do manual addressing.
Below is the configuration I'm using for HTTP:
<service behaviorConfiguration="LocalBehavior" name="RestService.CreditService">
<endpoint address="" behaviorConfiguration="web" binding="customBinding" bindingConfiguration="RawReceiveCapable" contract="RestService.ICreditService" />
</service>
<behavior name="LocalBehavior">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
<endpointBehaviors>
<behavior name="web">
<webHttp />
</behavior>
</endpointBehaviors>
<binding name="RawReceiveCapable">
<webMessageEncoding webContentTypeMapperType="RestService.Data.RawContentTypeMapper, RestService, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" />
<httpTransport manualAddressing="true" maxReceivedMessageSize="524288000"
transferMode="Streamed" />
</binding>
And here is the configuration I'm using for HTTPS:
<service behaviorConfiguration="SecureBehavior" name="RestService.CreditService">
<endpoint address="basic" behaviorConfiguration="web" binding="customBinding" bindingConfiguration="RawReceiveCapable" name="httpsEndpoint" contract="RestService.ICreditService" />
<host>
<baseAddresses>
<add baseAddress="http://sitcreditserviceszalecorp.cloudapp.net:3389/CreditService.svc" />
<add baseAddress="https://sitcreditserviceszalecorp.cloudapp.net:443/CreditService.svc" />
</baseAddresses>
</host>
</service>
<behavior name="SecureBehavior">
<serviceMetadata httpGetEnabled="false" httpsGetEnabled="true" />
<serviceDebug httpHelpPageEnabled="false" httpsHelpPageEnabled="true" includeExceptionDetailInFaults="true" />
</behavior>
<binding name="RawReceiveCapable">
<webMessageEncoding webContentTypeMapperType="RestService.Data.RawContentTypeMapper, RestService, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" />
<security authenticationMode="CertificateOverTransport"
requireSecurityContextCancellation ="true">
</security>
<httpsTransport manualAddressing="true" maxReceivedMessageSize="524288000" transferMode="Streamed" authenticationScheme="Anonymous" requireClientCertificate="false" />
</binding>
Can anyone point out what I'm doing wrong? Thanks.
I had the same issue until I came across an article suggesting to remove the security element. That worked for me.
Iam fairly new to Silver-light and WCF, so please bear with me.
I have silver-light application that calls .svc service. The service is being called successfully over https but i would also like to make it work with calls over plain http.
What modifications do i need to make to my web.config and ServiceReferences.ClientConfig files below.
My complete system.serviceModel section in my Web.config file is this.
<system.serviceModel>
<bindings>
<customBinding>
<binding name="MyApp.Web.GetData.customBinding" receiveTimeout="00:30:00" sendTimeout="00:30:00" >
<binaryMessageEncoding/>
<httpsTransport/>
</binding>
</customBinding>
</bindings>
<services>
<service name="MyApp.Web.GetData">
<endpoint address="" binding="customBinding" bindingConfiguration="MyApp.Web.GetData.customBinding" contract="MyApp.Web.GetData" />
<endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange"/>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="MyApp.Web.GetData">
<serviceMetadata httpsGetEnabled="true" httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="true"/>
<dataContractSerializer maxItemsInObjectGraph="2147483646"/>
</behavior>
<behavior name="">
<serviceMetadata httpsGetEnabled="true" httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
</system.serviceModel>
And my complete ServiceReferences.ClientConfig file is below
<configuration>
<system.serviceModel>
<bindings>
<customBinding>
<binding name="CustomBinding_GetData">
<binaryMessageEncoding />
<httpsTransport maxReceivedMessageSize="2147483647" maxBufferSize="2147483647" />
</binding>
</customBinding>
</bindings>
<client>
<endpoint address="//localhost/MyApp.Web/Webservice/GetData.svc"
binding="customBinding" bindingConfiguration="CustomBinding_GetData"
contract="GetData.GetData" name="CustomBinding_GetData" />
</client>
</system.serviceModel>
Try to add another endpoint and another binding with no ssl:
</customBinding>
</bindings>
<client>
<endpoint address="//localhost/MyApp.Web/Webservice/GetData.svc"
binding="customBinding" bindingConfiguration="CustomBinding_GetData-ssl"
contract="GetData.GetData" name="CustomBinding_GetData-ssl" />
<endpoint address="//localhost/MyApp.Web/Webservice/GetData.svc"
binding="customBinding" bindingConfiguration="CustomBinding_GetData"
contract="GetData.GetData" name="CustomBinding_GetData" />
</client>
</system.serviceModel>