I have a strange WCF behavior. When the service is hosted on IIS I can navigate to the service url and see the service wsdl, but any hit on the service operations return a 404.0 not found exception.
so this works
http://localhost:8000/Simulators/BackendService/service.svc
and this doesn't work
http://localhost:8000/Simulators/BackendService/service.svc/ProcessRequest
The behavior happens on one machine only and I tried the same source code with the exact same web.config on 2 other machines and they work perfectly fine. Which makes me sure that the problem is the IIS configuration on my machine but I couldn't figure out what is the problem.
Would anybody know what could be causing that problem?
Thanks,
<system.serviceModel>
<serviceHostingEnvironment aspNetCompatibilityEnabled="false" />
<bindings>
<customBinding>
<binding name="POXConfig">
<customTextMessageEncoding messageVersion="None" />
<httpTransport/>
</binding>
</customBinding>
</bindings>
<services>
<service behaviorConfiguration="MSAD.Bawaba.Backend.WebHost.BawabaBackendServiceBehavior" name="BawabaTestingTool.Simulators.BackendService.Service">
<endpoint address="ProcessRequest" binding="customBinding" bindingConfiguration="POXConfig" contract="MSAD.Bawaba.Backend.Service.IBackendService">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="MSAD.Bawaba.Backend.WebHost.BawabaBackendServiceBehavior">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug httpHelpPageEnabled="true" includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
</behaviors>
<extensions>
<bindingElementExtensions>
<add name="customTextMessageEncoding" type="MSAD.Bawaba.Backend.CustomEncoderBinding.CustomTextMessageEncodingElement, MSAD.Bawaba.Backend" />
</bindingElementExtensions>
</extensions>
Related
EDIT: Already fixed it... I only had to change the Project properties and enable SSL.
ORIGINAL QUESTION:
I'm developing a WCF service that will be hosted in an IIS server with SSL certificate.
My code works perfectly fine when I upload it to the server (that have all the certificates), but since I added the security to the web config, it crash when I try to debug it on my local machine.
I'm using the following web config for a SOAP service that don't need the SSL certificate and a REST service that need it:
<configuration>
...
<bindings>
<basicHttpBinding>
<binding name="SOAPEndPoint" />
</basicHttpBinding>
<webHttpBinding>
<binding name="SecureBinding" >
<security mode="Transport"></security>
</binding>
</webHttpBinding>
</bindings>
<services>
<service behaviorConfiguration="ServiceBehavior" name="xxx.WS">
<endpoint address="SOAP" binding="basicHttpBinding" name="SOAPEndPoint" contract="xxx.ISerSoap" />
<endpoint address="api" binding="webHttpBinding" name="RESTEndPoint" contract="xxx.ISerRest" behaviorConfiguration="RestBehavior" bindingConfiguration="SecureBinding"/>
<endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="ServiceBehavior">
<serviceMetadata httpsGetEnabled="true" httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name="RestBehavior">
<webHttp/>
</behavior>
</endpointBehaviors>
</behaviors>
<protocolMapping>
<add binding="basicHttpsBinding" scheme="https" />
</protocolMapping>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true" />
<directoryBrowse enabled="true" />
</system.webServer>
</configuration>
I want to be able to debug it without the need to change the web config each time I open it during debug and if I have to upload it to the server.
Someone knows a way to bypass the security when I call it in debug mode? Or an easy way to add support of https on my localhost?
Just find that the solution was to activate "SSL Enabled = true" on the project properties windows.
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 ?
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'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>
I am struggling to understand what I am doing wrong. I have a simple interface that accepts an array. I can't make it to handle more than ~150 items - getting back 400 Bad Request. What am I doing wrong? Can anyone spot anything? I looked thru this post and it appears to be the answer but it doesn't work for me: WCF maxReceivedMessageSize not being read from config.
The service is hosted in IIS7 and uses .NET 3.5. Here is my web.config:
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="MyService.basicHttpBinding" maxReceivedMessageSize="5000000" maxBufferSize="5000000">
<readerQuotas maxStringContentLength="5000000" maxArrayLength="5000000" />
</binding>
</basicHttpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior name="MyService.Service1Behavior">
<!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
<serviceMetadata httpGetEnabled="true"/>
<!-- Please set this to false when deploying -->
<serviceDebug includeExceptionDetailInFaults="True" httpHelpPageEnabled="True"/>
</behavior>
</serviceBehaviors>
</behaviors>
<services>
<service behaviorConfiguration="MyService.Service1Behavior" name="MyService">
<endpoint address="ws" binding="wsHttpBinding" contract="IMyService">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
<endpoint binding="basicHttpBinding" bindingConfiguration="MyService.basicHttpBinding" contract="IMyService" />
</service>
</services>
</system.serviceModel>
To troubleshoot turn on tracing both on the server and on the client, then inspect the log file. The error message points more to an object not being marked as [Serializable].
See http://msdn.microsoft.com/en-us/library/ms732023.aspx for guidance.
What's the config on the receiving end? I found the serializer blew up on receipt of lots of data.