I'm using the website which contain .svc file and hosted on https as rest api. My question is:
My website has SVCUTIL.exe is https://XXXXXXX but when I call it with https request it fails but working fine with http request.And I don’t want use SSL certificates
Thanks
This is my webconfig settings:
<serviceBehaviors>
<behavior name="Mybehaviour">
<serviceMetadata httpsGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
<services>
<service behaviorConfiguration="Mybehaviour" name="PBUIService">
<endpoint address="https://XXXXXXXXXXXXXXX" behaviorConfiguration="PBBehaviour" binding="webHttpBinding" bindingConfiguration="wsHttpBindingSettings" contract="PBUIService">
</endpoint>
<endpoint address="mex" binding="mexHttpsBinding"
contract="IMetadataExchange" />
</service>
</services>
I've added the following lines to make it work with https:
<system.serviceModel>
<bindings>
<webHttpBinding>
<binding name="webBinding">
<security mode="Transport">
</security>
</binding>
</webHttpBinding>
</bindings>
Related
When I use Live WCF service it shows error
There was no endpoint listening at this that could accept the message. This is often caused by an incorrect address or SOAP action
Put your end-point configuration on Web.config on root of your project.
this is sample of a web.config with end-point.
<system.web>
<compilation debug="true" targetFramework="4.0" />
</system.web>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="TransportSecurity">
<security mode="Transport">
<transport clientCredentialType="None"/>
</security>
</binding>
</basicHttpBinding>
</bindings>
<services>
<service behaviorConfiguration="TestWcfHttps1.Service1" name="TestWcfHttps1.Service1">
<endpoint address="https://MYSERVER/GpTest/Service1.svc"
binding="basicHttpBinding"
bindingConfiguration="TransportSecurity"
contract="TestWcfHttps1.IService1">
<identity>
<dns value="" />
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="TestWcfHttps1.Service1">
<serviceMetadata httpsGetEnabled="true" externalMetadataLocation="https://MYSERVER//GpTest/Service1.wsdl" />
<serviceDebug includeExceptionDetailInFaults="true"/>
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
</configuration>
The above sample code will fix your problem, but please describe more about your projects on your solution and put your code here. Did you consume the web-service in a class library and reference it on your web-app project ?
I had developed a windows service that hosts a WCF service. The service is installed on a server and the idea is to process some files on the local network (domain). Also, the service is executing as my domain user.
the configuration of the service is this:
<system.serviceModel>
<services>
<service name="Zeus.My.Upload.Service.MyHostedService">
<host>
<baseAddresses>
<add baseAddress="http://localhost:1089/Domain/Service"/>
</baseAddresses>
</host>
<endpoint address="http://localhost:1089/Domain/Service/Uploader" binding="basicHttpBinding" contract="Zeus.My.Upload.Contract.IHostedService" />
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
</service>
</services>
<bindings>
<basicHttpBinding>
<binding maxReceivedMessageSize="4294967296" transferMode="Streamed" sendTimeout="01:00:00" messageEncoding="Mtom">
<security mode="None">
</security>
</binding>
</basicHttpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior>
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true"/>
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
The issue with this configuration is that only my user is able to access and use this service. Other users of domain cannot even access to the URL.
How can I solve this issue?
Can someone please point me out what's wrong with this service configuration in web.config. I want to access this over HTTPS.
<system.serviceModel>
<bindings>
<wsHttpBinding>
<binding name="TransportSecurity">
<security mode="Transport">
<transport clientCredentialType="None"/>
</security>
</binding>
</wsHttpBinding>
</bindings>
<services>
<service name="WcfService1.Service1" behaviorConfiguration="WcfService1.Service1Behavior">
<endpoint binding="wsHttpBinding" bindingConfiguration="TransportSecurity" contract="WcfService1.IService1"/>
<endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange"/>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="WcfService1.Service1Behavior">
<serviceMetadata httpGetEnabled="false" httpsGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name="myBehavior">
<webHttp/>
<enableWebScript/>
</behavior>
</endpointBehaviors>
</behaviors>
<serviceHostingEnvironment aspNetCompatibilityEnabled="false">
</serviceHostingEnvironment>
</system.serviceModel>
I have enabled SSL using Test Certificates on IIS7. The Service1.svc is accessible without any error and I am getting 200 OK Response when accessed through a .NET Console client application. But I am getting 400 Bad Request while accessing the api defined in the service. The same api is working fine when used with HTTP configuration.
This is hard to explain so please ask me to clarify anything that is unclear.
I have 3 WCF web service libraries and 3 host applications I will call them Service1, Service2 and Service3. Service2 is in the same solution but is not relevant to this question at the moment.
Service1 references Service3 Host Application. Once it is compiled I cannot see any way to configure the URL for Service3 in Service1.
I would like it to be in the config for Service1 Host Application. Is this possible? I can't believe this is hard coded in the DLL?
Service1 Library App.Config:
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="Service3Data" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" />
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://MyHost/gws/GService3.svc/gwd"
binding="basicHttpBinding" bindingConfiguration="Service3Data"
contract="GServices3.IGws" name="Service3Data" />
</client>
<services>
<service name="MyNameSpace.Business.WebServices.Service1">
<endpoint address="" binding="basicHttpBinding" contract="MyNameSpace.Business.WebServices.IService1">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="http://localhost:8733/Design_Time_Addresses/MyNameSpace.Business.WebServices/Service1/" />
</baseAddresses>
</host>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior>
<serviceMetadata httpGetEnabled="True" httpsGetEnabled="True" />
<serviceDebug includeExceptionDetailInFaults="False" />
</behavior>
</serviceBehaviors>
</behaviors>
Service1 Host Application Web.Config (and where I need to configure the URL for Service3):
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="Service1Binding" openTimeout="00:10:00" maxBufferPoolSize="2147483646"
maxBufferSize="2147483646" maxReceivedMessageSize="2147483646">
<readerQuotas maxDepth="2147483646" maxStringContentLength="2147483646"
maxArrayLength="2147483646" maxBytesPerRead="2147483646" maxNameTableCharCount="2147483646" />
</binding>
</basicHttpBinding>
</bindings>
<services>
<service name="MyNameSpace.Business.WebServices.Service1">
<endpoint address="bwd" binding="basicHttpBinding" bindingConfiguration="Service1Binding"
name="BWData" contract="MyNameSpace.Business.WebServices.IService1" />
<endpoint address="mex" binding="mexHttpBinding" bindingConfiguration=""
contract="IMetadataExchange" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior>
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
</serviceBehaviors>
</behaviors>
<protocolMapping>
<add binding="basicHttpsBinding" scheme="https" />
</protocolMapping>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
When you create a proxy for a WCF service, you can always add a <system.serviceModel> section to the main assembly and configure all the settings in there (including the URL of the service you creates a proxy for).
If you add your proxy in a library assembly, you can still add <system.serviceModel> to the main (executable/web host/etc.) assembly.
You need to copy the <client> section from the library config to the host application config (together with its binding and possibly other elements).
I have a wcf service that users can chat trough it.
when I test it in local IIS it works, but when publish it in external server, and call a method, it throws:
Security negotiation failed because the remote party did not send back
a reply in a timely manner. This may be because the underlying
transport connection was aborted.
webconfig.conf
....
<system.serviceModel>
<bindings>
<wsDualHttpBinding>
<binding name="bind" textEncoding="utf-8">
<security mode="None" />
</binding>
</wsDualHttpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior name="svcbh">
<serviceMetadata httpGetEnabled="False" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
<services>
<service name="QasedakServer.QasedakAPI" behaviorConfiguration="svcbh">
<host>
<baseAddresses>
<add baseAddress="http://www.mywebsite.com/" />
</baseAddresses>
</host>
<endpoint name="duplexendpoint" address="" binding="wsDualHttpBinding" contract="QasedakServer.IQasedakAPI" bindingConfiguration="bind" />
<endpoint name="MetaDataTcpEndpoint" address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
</services>
</system.serviceModel>
....
my program uses dual channel mode connection.
plz help me.