WCF (413) Request Entity too Large - c#

Getting the error only on Uploading a byte[] of nearly 250k but downloading of the same byte[] array are fin using the same config.
I've looked into Streaming but the single parameter doesnt work and these file sizes are huge. I have been able to upload a simple text file of 630 bytes and it works fine.
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_IGenerateLetterWcf"
maxBufferSize="20000000" maxReceivedMessageSize="20000000"
closeTimeout="00:20:00" openTimeout="00:20:00" receiveTimeout="00:20:00" sendTimeout="00:20:00" >
<readerQuotas maxDepth="2000000" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://localhost:61394/GenerateLetterWcf.svc"
binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IGenerateLetterWcf"
contract="GenerateLetterWcfSvc.IGenerateLetterWcf" name="BasicHttpBinding_IGenerateLetterWcf" />
</client>
</system.serviceModel>
</configuration>
<?xml version="1.0"?>
<configuration>
<connectionStrings>
<add name="DTPLibrary.Properties.Settings.XXXXConnectionString1" connectionString="data source=XXXXX;initial catalog=XXXXXX;User ID=SQLAdmin;Password=XXXXXX" providerName="System.Data.SqlClient"/>
</connectionStrings>
<system.web>
<compilation debug="true" targetFramework="4.0" />
</system.web>
<system.net>
<settings>
<servicePointManager expect100Continue="false"/>
</settings>
</system.net>
<system.serviceModel>
<diagnostics>
<messageLogging
logEntireMessage="true"
logMalformedMessages="true"
logMessagesAtServiceLevel="true"
logMessagesAtTransportLevel="true"
maxMessagesToLog="3000000"
maxSizeOfMessageToLog="2000000"/>
</diagnostics>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_IEntitySearchWcf" maxBufferSize="10000000" maxReceivedMessageSize="10000000" closeTimeout="00:20:00" openTimeout="00:20:00" receiveTimeout="00:20:00" sendTimeout="00:20:00" />
<binding name="BasicHttpBinding_IBrokerWcf" maxBufferSize="6500000" maxReceivedMessageSize="6500000" />
<binding name="BasicHttpBinding_IProjectWcf" maxBufferSize="9900000" maxReceivedMessageSize="9900000" />
<binding name="BasicHttpBinding_ILoginWcf" maxReceivedMessageSize="20000000" maxBufferSize="20000000" />
<binding name="BasicHttpBinding_ISupportWcf" maxBufferSize="9900000" maxReceivedMessageSize="9900000" />
<binding name="BasicHttpBinding_IInscoWcf" maxBufferSize="100000000" maxReceivedMessageSize="100000000" />
<binding name="BasicHttpBinding_IClientMaintenanceWcf" maxReceivedMessageSize="9900000" />
<binding name="BasicHttpBinding_IWebUserWcf" maxReceivedMessageSize="9900000" />
<binding name="BasicHttpBinding_IRoleWcf" maxReceivedMessageSize="9900000" />
<binding name="BasicHttpBinding_ILabelWcf" maxReceivedMessageSize="10000000" maxBufferSize="10000000" />
<binding name="BasicHttpBinding_IProjectTypeWcfSvc" maxReceivedMessageSize="9900000" />
<binding name="BasicHttpBinding_IDropDownWcf" maxBufferSize="100000000" maxReceivedMessageSize="100000000" />
<binding name="BasicHttpBinding_IDefaultCertLimitWcf" maxBufferSize="100000000" maxReceivedMessageSize="100000000" />
<binding name="BasicHttpBinding_IConfigurationWcf" />
<binding name="BasicHttpBinding_IEndorsementsWcf" />
<binding name="BasicHttpBinding_IProjectCertReqWcf" maxBufferSize="2000000000" maxReceivedMessageSize="2000000000" />
<binding name="BasicHttpBinding_IInsuredEntryWcf" maxBufferSize="1000000000" maxReceivedMessageSize="1000000000" />
<binding name="BasicHttpBinding_ICertWcf" maxBufferSize="1000000000" maxReceivedMessageSize="1000000000" />
<binding name="BasicHttpBinding_IDocumentWcf" maxBufferSize="1000000000" maxReceivedMessageSize="1000000000" />
<binding name="BasicHttpBinding_IReportsWcf" />
<binding name="BasicHttpBinding_ICertGenLetterTemplWcf" />
<binding name="BasicHttpBinding_IGenerateLetterWcf" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647"
closeTimeout="00:20:00" openTimeout="00:20:00" receiveTimeout="00:20:00" sendTimeout="00:20:00"
/>
<binding name="BasicHttpBinding_ILinkImagesWcf" maxBufferSize="1000000000" maxReceivedMessageSize="1000000000" />
<binding name="BasicHttpBinding_IErrorLogWcf" />
<binding name="BasicHttpBinding_IDashBoardWcf" />
<binding name="BasicHttpBinding_IReviewScannedCertificateWcf" maxBufferSize="1000000000" maxReceivedMessageSize="1000000000" />
<binding name="BasicHttpBinding_IAllEndorsementsWcf" />
<binding name="BasicHttpBinding_IScanDocumentWcf" />
<binding name="BasicHttpBinding_IUserWcf" />
<binding name="BasicHttpBinding_IOutputLogWcf" />
<binding name="BasicHttpBinding_IStreamServiceWcf" closeTimeout="00:20:00"
openTimeout="00:20:00" receiveTimeout="00:20:00" sendTimeout="00:20:00"
maxBufferPoolSize="2147483647" maxBufferSize="2147483647"
maxReceivedMessageSize="2147483647" transferMode="Streamed" messageEncoding="Mtom"/>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://localhost:61394/EntitySearchWcf.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IEntitySearchWcf" contract="EntitySearchWcfSvc.IEntitySearchWcf" name="BasicHttpBinding_IEntitySearchWcf" />
<endpoint address="http://localhost:61394/BrokerWcf.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IBrokerWcf" contract="BrokerWcfSvc.IBrokerWcf" name="BasicHttpBinding_IBrokerWcf" />
<endpoint address="http://localhost:61394/ProjectWcf.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IProjectWcf" contract="ProjectWcfSvc.IProjectWcf" name="BasicHttpBinding_IProjectWcf" />
<endpoint address="http://localhost:61394/SupportWcf.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_ISupportWcf" contract="SupportWcfSvc.ISupportWcf" name="BasicHttpBinding_ISupportWcf" />
<endpoint address="http://localhost:61394/LoginWcf.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_ILoginWcf" contract="LoginWcfSvc.ILoginWcf" name="BasicHttpBinding_ILoginWcf" />
<endpoint address="http://localhost:61394/InscoWcf.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IInscoWcf" contract="InscoWcfSvc.IInscoWcf" name="BasicHttpBinding_IInscoWcf" />
<endpoint address="http://localhost:61394/ClientMaintenanceWcf.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IClientMaintenanceWcf" contract="ClientMaintenanceWcfSvc.IClientMaintenanceWcf" name="BasicHttpBinding_IClientMaintenanceWcf" />
<endpoint address="http://localhost:61394/WebUserWcf.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IWebUserWcf" contract="WebUserWcfSvc.IWebUserWcf" name="BasicHttpBinding_IWebUserWcf" />
<endpoint address="http://localhost:61394/RoleWcf.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IRoleWcf" contract="RoleWcfSvc.IRoleWcf" name="BasicHttpBinding_IRoleWcf" />
<endpoint address="http://localhost:61394/LabelWcf.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_ILabelWcf" contract="LabelWcfSvc.ILabelWcf" name="BasicHttpBinding_ILabelWcf" />
<endpoint address="http://localhost:61394/ProjectTypeWcfSvc.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IProjectTypeWcfSvc" contract="ProjectTypeWcfSvc.IProjectTypeWcfSvc" name="BasicHttpBinding_IProjectTypeWcfSvc" />
<endpoint address="http://localhost:61394/DefaultCertLimitWcf.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IDefaultCertLimitWcf" contract="DefaultCertLimitWcfSvc.IDefaultCertLimitWcf" name="BasicHttpBinding_IDefaultCertLimitWcf" />
<endpoint address="http://localhost:61394/DropDownWcf.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IDropDownWcf" contract="DropDownWcfSvc.IDropDownWcf" name="BasicHttpBinding_IDropDownWcf" />
<endpoint address="http://localhost:61394/ConfigurationWcf.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IConfigurationWcf" contract="ConfigurationWcfSvc.IConfigurationWcf" name="BasicHttpBinding_IConfigurationWcf" />
<endpoint address="http://localhost:61394/EndorsementsWcf.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IEndorsementsWcf" contract="EndorsementsWcfSvc.IEndorsementsWcf" name="BasicHttpBinding_IEndorsementsWcf" />
<endpoint address="http://localhost:61394/ProjectCertReqWcf.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IProjectCertReqWcf" contract="ProjectCertReqWcfSvc.IProjectCertReqWcf" name="BasicHttpBinding_IProjectCertReqWcf" />
<endpoint address="http://localhost:61394/InsuredEntryWcf.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IInsuredEntryWcf" contract="InsuredEntryWcfSvc.IInsuredEntryWcf" name="BasicHttpBinding_IInsuredEntryWcf" />
<endpoint address="http://localhost:61394/CertWcf.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_ICertWcf" contract="CertWcfSvc.ICertWcf" name="BasicHttpBinding_ICertWcf" />
<endpoint address="http://localhost:61394/DocumentWcf.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IDocumentWcf" contract="DocumentWcfSvc.IDocumentWcf" name="BasicHttpBinding_IDocumentWcf" />
<endpoint address="http://localhost:61394/ReportsWcf.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IReportsWcf" contract="ReportsWcfSvc.IReportsWcf" name="BasicHttpBinding_IReportsWcf" />
<endpoint address="http://localhost:61394/CertGenLetterTemplWcf.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_ICertGenLetterTemplWcf" contract="CertGenLetterTemplWcfSvc.ICertGenLetterTemplWcf" name="BasicHttpBinding_ICertGenLetterTemplWcf" />
<endpoint address="http://localhost:61394/GenerateLetterWcf.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IGenerateLetterWcf" contract="GenerateLetterWcfSvc.IGenerateLetterWcf" name="BasicHttpBinding_IGenerateLetterWcf" />
<endpoint address="http://localhost:61394/LinkImagesWcf.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_ILinkImagesWcf" contract="LinkImagesWcfSvc.ILinkImagesWcf" name="BasicHttpBinding_ILinkImagesWcf" />
<endpoint address="http://localhost:61394/ErrorLogWcf.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IErrorLogWcf" contract="ErrorLogWcfSvc.IErrorLogWcf" name="BasicHttpBinding_IErrorLogWcf" />
<endpoint address="http://localhost:61394/DashBoardWcf.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IDashBoardWcf" contract="DashboardWcfSvc.IDashBoardWcf" name="BasicHttpBinding_IDashBoardWcf" />
<endpoint address="http://localhost:61394/ReviewScannedCertificateWcf.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IReviewScannedCertificateWcf" contract="ReviewScannedCertificateWcfSvc.IReviewScannedCertificateWcf" name="BasicHttpBinding_IReviewScannedCertificateWcf" />
<endpoint address="http://localhost:61394/AllEndorsementsWcf.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IAllEndorsementsWcf" contract="AllEndorsementsWcfSvc.IAllEndorsementsWcf" name="BasicHttpBinding_IAllEndorsementsWcf" />
<endpoint address="http://localhost:61394/ScanDocumentWcf.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IScanDocumentWcf" contract="ScanDocumentWcfSvc.IScanDocumentWcf" name="BasicHttpBinding_IScanDocumentWcf" />
<endpoint address="http://localhost:61394/UserWcf.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IUserWcf" contract="UserWcfSvc.IUserWcf" name="BasicHttpBinding_IUserWcf" />
<endpoint address="http://localhost:61394/OutputLogWcf.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IOutputLogWcf" contract="OutputLogWcfSvc.IOutputLogWcf" name="BasicHttpBinding_IOutputLogWcf" />
<endpoint address="http://localhost:61394/StreamServiceWcf.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IStreamServiceWcf" contract="StreamServiceWcfSvc.IStreamServiceWcf" name="BasicHttpBinding_IStreamServiceWcf" />
</client>
<behaviors>
<serviceBehaviors>
<behavior>
<!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
<serviceMetadata httpGetEnabled="true"/>
<!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information -->
<serviceDebug includeExceptionDetailInFaults="true"/>
<dataContractSerializer maxItemsInObjectGraph="1365536" />
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" aspNetCompatibilityEnabled="true" />
<standardEndpoints>
<webHttpEndpoint>
<standardEndpoint name="" helpEnabled="true" maxReceivedMessageSize="65536000"/>
</webHttpEndpoint>
</standardEndpoints>
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
<system.diagnostics>
<trace autoflush="true" />
<sources>
<source name="System.ServiceModel.MessageLogging">
<listeners>
<add name="messages"
type="System.Diagnostics.XmlWriterTraceListener"
initializeData="c:\logs\messages.svclog" />
</listeners>
</source>
<source name="System.ServiceModel"
switchValue="Warning, Critical, Error, Verbose"
propagateActivity="true">
<listeners>
<add name="sdt"
type="System.Diagnostics.XmlWriterTraceListener"
initializeData= "c:\logs\service.svclog" />
</listeners>
</source>
</sources>
</system.diagnostics>
</configuration>

I have a question about your present configuration. Why you use the absolute service address in your endpoint address? if the service is hosted in IIS, the base address is provided by the IIS site binding module.
Thereby I suspect the current live connection doesn’t use this endpoint address, which results in the failure of the MaxReceivedMessageSize setting. I would like to know what the service address the client actually used is. Only apply the configuration on the correct service endpoint address can take effect.
Updated.
It seems that the above configuration is on the client-side, and the below configuration is on the server-side. Also, the WCF service contains multiple service contracts.
The configuration on the server-side doesn’t explicitly declare how does the service is created. There are neither Services section nor ProtocolMapping section in the configuration file. like the below form.
<services>
<service name="ConsoleApp3.TestService">
<endpoint address="" binding="basicHttpBinding" contract="ConsoleApp3.ITestService" ></endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"></endpoint>
</service>
</services>
And,
<protocolMapping>
<add binding="webHttpBinding" scheme="http"/>
</protocolMapping>
Namely, it uses the default Basichttpbinding to create the service. there is no way to apply the setting to the right service endpoint.
I suggest you attempt the below configuration on the server-side.
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="mybinding" maxBufferSize="20000000" maxReceivedMessageSize="2147483647" >
<readerQuotas maxDepth="2000000" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
</binding>
</basicHttpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior>
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
<protocolMapping>
<add binding="basicHttpBinding" scheme="http" bindingConfiguration="mybinding"/>
</protocolMapping>
</system.serviceModel>
It can also support multiple service contracts.
Feel free to let me know if the problem still exists.

Related

WCF error 413 Request Entity too la

I have recently a new exception. When I try to call a method with a byte array in parameter I get a 413 error.
I try to change maxBufferSize, maxReceivedMessageSize and maxBufferPoolSize but nothing had changed.
In my app.config of my application I have :
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="soap"
maxReceivedMessageSize="1116553600"
maxBufferPoolSize="1116553600"
maxBufferSize="1116553600"/>
</basicHttpBinding>
<wsHttpBinding>
<binding name="mex" maxReceivedMessageSize="1116553600"
maxBufferPoolSize="1116553600">
<security mode="None" />
</binding>
</wsHttpBinding>
</bindings>
<client>
<endpoint address="http://localhost:9804/ServiceBX.svc/soap"
binding="basicHttpBinding" bindingConfiguration="soap" contract="ServiceReferenceBX.ServiceBX"
name="soap" />
</client>
</system.serviceModel>
And in my web.config of my WCF service I have :
<system.serviceModel>
<services>
<service name="BXSportWCFLib.ServiceBX" behaviorConfiguration="MyServiceBehavior">
<endpoint name="rest" address="" binding="webHttpBinding" contract="BXSportWCFLib.ServiceBX" behaviorConfiguration="restBehavior" />
<endpoint name="mex" address="mex" binding="mexHttpBinding" contract="BXSportWCFLib.ServiceBX" />
<endpoint name="soap" address="soap" binding="basicHttpBinding" contract="BXSportWCFLib.ServiceBX" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="MyServiceBehavior" >
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name="restBehavior">
<webHttp />
</behavior>
</endpointBehaviors>
</behaviors>
</system.serviceModel>
I see lot of things on this error but anything I try don't work.
First I like to know in wich file I must modify ?
I try to add bindings and modify my endoint but now when I execute my application I had a : "The requested service can't be activated"
<system.web>
<compilation debug="true" targetFramework="4.5.2" />
<httpRuntime targetFramework="4.5.2" />
<httpModules>
<add name="ApplicationInsightsWebTracking" type="Microsoft.ApplicationInsights.Web.ApplicationInsightsHttpModule, Microsoft.AI.Web" />
</httpModules>
</system.web>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="soap"
maxReceivedMessageSize="116553600"
maxBufferPoolSize="116553600"
maxBufferSize="116553600">
<readerQuotas maxStringContentLength="116533600" />
</binding>
</basicHttpBinding>
<webHttpBinding>
<binding name="web"
maxReceivedMessageSize="116553600"
maxBufferPoolSize="11653600"
maxBufferSize="116553600">
<readerQuotas maxStringContentLength="116533600" />
</binding>
</webHttpBinding>
</bindings>
<services>
<service name="BXSportWCFLib.ServiceBX" behaviorConfiguration="MyServiceBehavior">
<endpoint name="rest"
address=""
binding="webHttpBinding"
bindingConfiguration="web"
contract="BXSportWCFLib.ServiceBX"
behaviorConfiguration="restBehavior" />
<endpoint name="soap"
address="soap"
binding="basicHttpBinding"
bindingConfiguration="soap"
contract="BXSportWCFLib.ServiceBX" />
<endpoint name="mex"
address="mex"
binding="mexHttpBinding"
contract="IMetaDataExchange" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="MyServiceBehavior" >
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name="restBehavior" >
<webHttp />
</behavior>
</endpointBehaviors>
</behaviors>
</system.serviceModel>
Thanks
It sounds like you're receiving the error when calling the service, so you need to fix the config file for the service, not the client.
The posted config for the service does not specify any binding configurations, so WCF will use the default settings for the specified values. You need to a) define the binding configurations you want to use and b) assign them to the endpoints. Failure to do both will result in WCF still using the default values.
In your service config, add the following in the <system.serviceModel> section:
<bindings>
<basicHttpBinding>
<binding name="soap"
maxReceivedMessageSize="116553600"
maxBufferPoolSize="116553600"
maxBufferSize="116553600">
<readerQuotas maxStringContentLength="116533600" />
</binding>
</basicHttpBinding>
<webHttpBinding
<binding name="web"
maxReceivedMessageSize="116553600"
maxBufferPoolSize="11653600"
maxBufferSize="116553600">
<readerQuotas maxStringContentLength="116533600" />
</binding>
</webHttpBinding>
</bindings>
Note that you need to specify the configuration for both basicHttpBinding and webHttpBinding.
Next, assign them to the correct endpoints via the bindingConfiguration attribute on the <endpoint> element:
<endpoint name="rest"
address=""
binding="webHttpBinding"
bindingConfiguration="web"
contract="BXSportWCFLib.ServiceBX"
behaviorConfiguration="restBehavior" />
<endpoint name="soap"
address="soap"
binding="basicHttpBinding"
bindingConfiguration="soap"
contract="BXSportWCFLib.ServiceBX" />
Thirdly, your mex endpoint is specifying the wrong contract - it should be IMetaDataExchange:
<endpoint name="mex"
address="mex"
binding="mexHttpBinding"
contract="IMetaDataExchange" />
If you still get the 413 error, you will also want to adjust the maxRequestLength in <httpRuntime> element. This goes in the config file in the <system.webServer> section:
<system.web>
<httpRuntime maxRequestLength="116533600" />
</system.web>
the default for maxRequestLength is 4 MB, but most likely the issue is with the values being used for the bindings on your service.
The solution work !
I had add bindings but I change the IMetaDataExchange and write BXSportWCFLib.ServiceBX and I have not the message "The requested service can't be activated"
<system.web>
<compilation debug="true" targetFramework="4.5.2" />
<httpRuntime targetFramework="4.5.2" />
<httpModules>
<add name="ApplicationInsightsWebTracking" type="Microsoft.ApplicationInsights.Web.ApplicationInsightsHttpModule, Microsoft.AI.Web" />
</httpModules>
</system.web>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="soap"
maxReceivedMessageSize="116553600"
maxBufferPoolSize="116553600"
maxBufferSize="116553600">
<readerQuotas maxStringContentLength="116533600" />
</binding>
</basicHttpBinding>
<webHttpBinding>
<binding name="web"
maxReceivedMessageSize="116553600"
maxBufferPoolSize="11653600"
maxBufferSize="116553600">
<readerQuotas maxStringContentLength="116533600" />
</binding>
</webHttpBinding>
</bindings>
<services>
<service name="BXSportWCFLib.ServiceBX" behaviorConfiguration="MyServiceBehavior">
<endpoint name="rest"
address=""
binding="webHttpBinding"
bindingConfiguration="web"
contract="BXSportWCFLib.ServiceBX"
behaviorConfiguration="restBehavior" />
<endpoint name="soap"
address="soap"
binding="basicHttpBinding"
bindingConfiguration="soap"
contract="BXSportWCFLib.ServiceBX" />
<endpoint name="mex"
address="mex"
binding="mexHttpBinding"
contract="IMetaDataExchange" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="MyServiceBehavior" >
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name="restBehavior" >
<webHttp />
</behavior>
</endpointBehaviors>
</behaviors>
</system.serviceModel>

"There was no endpoint listening" - Configuration Mismatch Perhaps?

I get
"There was no endpoint listening at https://localhost/BassCoastServices/GeneralUtilityService.svc that
could accept the message. This is often caused by an incorrect address
or SOAP action. See InnerException, if present, for more details."
when I call the GeneralUtilityService from the client side and
"There was no channel actively listening at 'https://laura-laptop/BassCoastServices/GeneralUtilityService.svc'.
This is often caused by an incorrect address URI. Ensure that the
address to which the message is sent matches an address on which a
service is listening."
shows up when I debug w3wp.
Is there some sort of tool I can use that will make sure a client and server config file line up?
If this is an easy fix, please see the below App and Web config files.
App.config
<?xml version="1.0"?>
<configuration>
<appSettings>
<add key="Username" value="sampleuser"/>
<add key="Password" value="samplepassword"/>
<add key="basePath" value="C:\Temp"/>
</appSettings>
<system.serviceModel>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true"/>
<bindings>
<wsHttpBinding>
<binding name="standardBinding" closeTimeout="01:00:00" openTimeout="01:00:00" receiveTimeout="01:00:00" sendTimeout="01:00:00" hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="524288" maxReceivedMessageSize="2147483647" messageEncoding="Text" textEncoding="utf-8" allowCookies="true">
<readerQuotas maxDepth="32" maxStringContentLength="2147483647" maxArrayLength="163840" maxBytesPerRead="4096" maxNameTableCharCount="16384"/>
<reliableSession ordered="true" inactivityTimeout="01:00:00" enabled="false"/>
<security mode="TransportWithMessageCredential" >
<transport clientCredentialType="Certificate" proxyCredentialType="None" />
<message clientCredentialType="UserName" negotiateServiceCredential="true" algorithmSuite="Default" establishSecurityContext="true" />
</security>
</binding>
</wsHttpBinding>
</bindings>
<behaviors>
<endpointBehaviors>
<behavior name="ClientCertificateBehavior">
<callbackDebug includeExceptionDetailInFaults="true"/>
<clientCredentials>
<clientCertificate findValue="localhost" x509FindType="FindByIssuerName" storeLocation="LocalMachine" storeName="My">
</clientCertificate>
</clientCredentials>
<dataContractSerializer maxItemsInObjectGraph="2147483647"/>
</behavior>
</endpointBehaviors>
</behaviors>
<client>
<endpoint address="https://localhost/BassCoastServices/GeneralUtilityService.svc" behaviorConfiguration="ClientCertificateBehavior" binding="wsHttpBinding" bindingConfiguration="standardBinding" contract="Adapt.WCF.IGeneralUtilityService" name="IGeneralUtilityServiceEndPoint">
<identity>
<dns value="localhost"/>
</identity>
</endpoint>
</client>
</system.serviceModel>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6"/>
</startup>
</configuration>
Web.config
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<appSettings>
<add key="aspnet:UseTaskFriendlySynchronizationContext" value="true"/>
<add key="DatabaseConnectionString" value="Data Source=(local)\SQL2014;Initial Catalog=XIVICProduction;User ID=sa;Password=sameplepassword;MultipleActiveResultSets=True"/>
<add key="LogFilePath" value="C:\inetpub\wwwroot\Xivic\BassCoastServices\Log\Log.txt"/>
<add key="AllowMissingExternalIDs" value="true"/>
<!--No need to change-->
<add key="LogFileTypeLevel" value="Error"/>
<add key="SqlServerDateTimeStyle" value="103"/>
<add key="DatabaseType" value="Sql"/>
<add key="EnforceSecurityAtBusinessRulesLayer" value="false"/>
<add key="DateComparisonInaccuracy" value="35000"/>
<add key="CacheAccessItemsAtBusinessLayer" value="true"/>
<add key="CacheRecordsAtDataLayer" value="true"/>
<add key="SesionTimeout" value="1440"/>
</appSettings>
<system.serviceModel>
<services>
<!-- ENDPOINTS -->
<service name="IGeneralUtilityServiceEndPoint" behaviorConfiguration="UserNameBehaviour">
<endpoint binding="wsHttpBinding" contract="Adapt.WCF.IGeneralUtilityService" bindingConfiguration="wsHttpEndpointBinding"/>
</service>
</services>
<!-- BEHAVIOURS -->
<behaviors>
<serviceBehaviors>
<behavior name="UserNameBehaviour">
<serviceThrottling maxConcurrentCalls="2147483647" maxConcurrentInstances="2147483647" maxConcurrentSessions="2147483647" />
<serviceDebug includeExceptionDetailInFaults="True" />
<serviceCredentials>
<userNameAuthentication userNamePasswordValidationMode="Custom" customUserNamePasswordValidatorType="Adapt.WCF.Security.CustomUserNameValidator, Adapt.WCF" />
<serviceCertificate findValue="localhost" x509FindType="FindByIssuerName" storeLocation="LocalMachine" storeName="My">
</serviceCertificate>
</serviceCredentials>
<dataContractSerializer maxItemsInObjectGraph="2147483647" />
</behavior>
</serviceBehaviors>
</behaviors>
<!-- BINDINGS -->
<bindings>
<wsHttpBinding>
<binding name="wsHttpEndpointBinding">
<security mode="TransportWithMessageCredential">
<transport clientCredentialType="None" />
<message clientCredentialType="UserName" />
</security>
</binding>
</wsHttpBinding>
</bindings>
</system.serviceModel>
<system.diagnostics>
<sources>
<source name="System.ServiceModel"
switchValue="Information, ActivityTracing"
propagateActivity="true">
<listeners>
<add name="traceListener"
type="System.Diagnostics.XmlWriterTraceListener"
initializeData= "C:\inetpub\wwwroot\Xivic\BassCoastServices\Log\Traces.svclog" />
</listeners>
</source>
</sources>
</system.diagnostics>
<!--startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.1"/>
</startup-->
</configuration>
Calling WCF
_Channel = GetProxy<IGeneralUtilityService>();
_Channel.BeginTransaction(transactionId);
_Channel.CommitTransaction(transactionId);
public static T GetProxy<T>()
{
var channelFactory = new ChannelFactory<T>(string.Format("{0}EndPoint", typeof(T).Name));
channelFactory.Credentials.UserName.UserName = ConfigurationSettings.AppSettings["Username"];
channelFactory.Credentials.UserName.Password = ConfigurationSettings.AppSettings["Password"];
var workflowProxy = channelFactory.CreateChannel();
return workflowProxy;
}
Thanks in advance!
Update: I don't know what I did but now I'm getting
"Content Type application/soap+xml; charset=utf-8 was not supported by service http://localhost/BassCoastServices/GeneralUtilityService.svc. The client and service bindings may be mismatched."
Your problem is the way you create your channel factory. Some how it can not get the correct EndpointConfigurationName.
I'm not quite familiar on how to use only the EndpointConfigurationName as parameter in Channel Factory but you can try it this way:
var channelFactory = new ChannelFactory<T>("*", new EndpointAddress("https://localhost/BassCoastServices/GeneralUtilityService.svc"));
Well I don't know what the problem was but for anyone looking for a solution to this problem here are my web and app config files:
Web.config
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<appSettings>
<!--Please configure-->
<!--Laura Local-->
<add key="DatabaseConnectionString" value="Data Source=(local)\SQL2014;Initial Catalog=XIVICProduction;User ID=sa;Password=samplepassword;MultipleActiveResultSets=True"/>
<!--No need to change-->
<add key="LogFilePath" value="C:\Temp\Log\log.txt" />
<add key="LogFileTypeLevel" value="Information" />
<add key="SqlServerDateTimeStyle" value="103" />
<add key="DatabaseType" value="Sql" />
<add key="EnforceSecurityAtBusinessRulesLayer" value="false" />
<add key="DateComparisonInaccuracy" value="35000" />
<add key="CacheAccessItemsAtBusinessLayer" value="true" />
<add key="CacheRecordsAtDataLayer" value="true" />
<!--Email Configuration-->
<!--add key="EmailAlertHost" value=""[INSERT="" HOST="" ADDRESS=""]/>
<add key="EmailAlertUsername" value=""[INSERT="" USERNAME=""]/>
<add key="EmailAlertPassword" value=""[INSERT="" PASSWORD=""] />
<add key="EmailAlertReplyToAddress" value=[INSERT REPLY TO ADDRESS] />
<add key="EmailAlertToAddress" value=""/>
<add key="EmailAlertCCAddress" value=""/>
<add key="EmailAlertSubject" value="*WARNING* - A Fatal Error Occurred # {0} - *WARNING*"/>
<add key="EmailAlertPriority" value="High"/-->
</appSettings>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6"/>
</startup>
<system.web>
<compilation debug="true"/>
</system.web>
<system.serviceModel>
<services>
<!--AssetInventoryService-->
<service name="Adapt.WCF.AssetInventory.AssetInventoryService" behaviorConfiguration="UserNameBehaviour">
<endpoint binding="customBinding" contract="Adapt.WCF.AssetInventory.AssetInventoryService" bindingConfiguration="UserNameBinding" />
</service>
<!--AssetValuationUtilityService-->
<service name="Adapt.WCF.AssetValuation.AssetValuationUtilityService" behaviorConfiguration="UserNameBehaviour">
<endpoint binding="customBinding" contract="Adapt.WCF.IAssetValuationUtilityService" bindingConfiguration="UserNameBinding" />
</service>
<!--CodeGenerationService-->
<service name="Adapt.WCF.CodeGeneration.CodeGenerationService" behaviorConfiguration="UserNameBehaviour">
<endpoint binding="customBinding" contract="Adapt.WCF.CodeGeneration.CodeGenerationService" bindingConfiguration="UserNameBinding" />
</service>
<!--CodeUtilityService-->
<service name="Adapt.WCF.CodeGeneration.CodeUtilityService" behaviorConfiguration="UserNameBehaviour">
<endpoint binding="customBinding" contract="Adapt.WCF.CodeGeneration.ICodeUtilityService" bindingConfiguration="UserNameBinding"/>
<host>
<baseAddresses>
<add baseAddress="http://localhost:8731/CodeUtilityService.svc" />
</baseAddresses>
</host>
</service>
<!--DataSchemaService-->
<service name="Adapt.WCF.DataSchema.DataSchemaService" behaviorConfiguration="UserNameBehaviour">
<endpoint binding="customBinding" contract="Adapt.WCF.DataSchema.DataSchemaService" bindingConfiguration="UserNameBinding" />
</service>
<!--DataTransactionService-->
<service name="Adapt.WCF.DataTransaction.DataTransactionService" behaviorConfiguration="UserNameBehaviour">
<endpoint binding="customBinding" contract="Adapt.WCF.DataTransaction.DataTransactionService" bindingConfiguration="UserNameBinding" />
</service>
<!--GeneralUtilityService-->
<service name="Adapt.WCF.GeneralUtilityService" behaviorConfiguration="UserNameBehaviour">
<endpoint binding="customBinding" contract="Adapt.WCF.IGeneralUtilityService" bindingConfiguration="UserNameBinding"/>
<host>
<baseAddresses>
<add baseAddress="http://localhost:8731/GeneralUtilityService.svc" />
</baseAddresses>
</host>
</service>
<!--SecurityService-->
<service name="Adapt.WCF.Security.SecurityService" behaviorConfiguration="UserNameBehaviour">
<endpoint binding="customBinding" contract="Adapt.WCF.Security.SecurityService" bindingConfiguration="UserNameBinding" />
</service>
<!--SyncService-->
<service name="Adapt.WCF.SyncService" behaviorConfiguration="UserNameBehaviour">
<endpoint binding="customBinding" contract="Adapt.WCF.ISyncService" bindingConfiguration="UserNameBinding" />
</service>
<!--SystemSetupService-->
<service name="Adapt.WCF.SystemSetup.SystemSetupService" behaviorConfiguration="UserNameBehaviour">
<endpoint binding="customBinding" contract="Adapt.WCF.SystemSetup.SystemSetupService" bindingConfiguration="UserNameBinding" />
</service>
<!--TaskManagementService-->
<service name="Adapt.WCF.TaskManagement.TaskManagementService" behaviorConfiguration="UserNameBehaviour">
<endpoint binding="customBinding" contract="Adapt.WCF.TaskManagement.TaskManagementService" bindingConfiguration="UserNameBinding" />
</service>
</services>
<!-- BEHAVIOURS -->
<behaviors>
<serviceBehaviors>
<behavior name="UserNameBehaviour">
<serviceThrottling maxConcurrentCalls="2147483647" maxConcurrentInstances="2147483647" maxConcurrentSessions="2147483647" />
<serviceDebug includeExceptionDetailInFaults="True" />
<serviceCredentials>
<userNameAuthentication userNamePasswordValidationMode="Custom" customUserNamePasswordValidatorType="Adapt.WCF.Security.CustomUserNameValidator, Adapt.WCF" />
<serviceCertificate findValue="localhost" x509FindType="FindByIssuerName" storeLocation="LocalMachine" storeName="My">
</serviceCertificate>
</serviceCredentials>
<dataContractSerializer maxItemsInObjectGraph="2147483647" />
</behavior>
</serviceBehaviors>
</behaviors>
<!-- BINDINGS -->
<bindings>
<customBinding>
<binding name="UserNameBinding" closeTimeout="23:00:00" openTimeout="23:00:00" receiveTimeout="23:00:00" sendTimeout="23:00:00">
<security authenticationMode="SecureConversation" requireSecurityContextCancellation="true">
<secureConversationBootstrap authenticationMode="UserNameForSslNegotiated">
</secureConversationBootstrap>
</security>
<textMessageEncoding>
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
</textMessageEncoding>
<httpTransport transferMode="Buffered" maxReceivedMessageSize="2147483647" maxBufferSize="2147483647" />
</binding>
</customBinding>
</bindings>
</system.serviceModel>
<!--<system.diagnostics>
<sources>
<source name="System.ServiceModel"
switchValue="Information, ActivityTracing"
propagateActivity="true">
<listeners>
<add name="traceListener"
type="System.Diagnostics.XmlWriterTraceListener"
initializeData= "c:\temp\log\Traces.svclog" />
</listeners>
</source>
</sources>
</system.diagnostics>-->
</configuration>
App.config
<?xml version="1.0"?>
<configuration>
<appSettings>
<add key="Username" value="dspec"/>
<add key="Password" value="samplepassword"/>
<add key="BasePath" value="c:\FileDrop"/>
</appSettings>
<system.serviceModel>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true"/>
<bindings>
<wsHttpBinding>
<binding name="standardBinding" closeTimeout="01:00:00" openTimeout="01:00:00" receiveTimeout="01:00:00" sendTimeout="01:00:00" hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="524288" maxReceivedMessageSize="2147483647" messageEncoding="Text" textEncoding="utf-8" allowCookies="true">
<readerQuotas maxDepth="32" maxStringContentLength="2147483647" maxArrayLength="163840" maxBytesPerRead="4096" maxNameTableCharCount="16384"/>
<reliableSession ordered="true" inactivityTimeout="01:00:00" enabled="false"/>
<security mode="Message">
<transport clientCredentialType="Certificate" proxyCredentialType="None" realm=""/>
<message clientCredentialType="UserName" negotiateServiceCredential="true" algorithmSuite="Default" establishSecurityContext="true"/>
</security>
</binding>
</wsHttpBinding>
</bindings>
<behaviors>
<endpointBehaviors>
<behavior name="ClientCertificateBehavior">
<callbackDebug includeExceptionDetailInFaults="true"/>
<clientCredentials>
<serviceCertificate>
<authentication certificateValidationMode="None"/>
</serviceCertificate>
</clientCredentials>
<dataContractSerializer maxItemsInObjectGraph="2147483647"/>
</behavior>
</endpointBehaviors>
</behaviors>
<client>
<endpoint address="http://localhost/BassCoastServices/GeneralUtilityService.svc" behaviorConfiguration="ClientCertificateBehavior" binding="wsHttpBinding" bindingConfiguration="standardBinding" contract="Adapt.WCF.IGeneralUtilityService" name="IGeneralUtilityServiceEndPoint">
<identity>
<dns value="localhost"/>
</identity>
</endpoint>
</client>
</system.serviceModel>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6"/>
</startup>
</configuration>

issue firing off wcf service to send xml file

I new to wcf however i'm attempting to use net.tcp binding wcf service to transmit an xml file to the client.
I can get up to creating the xml file and upon attempting to connect to my wcf service fails.
I followed this guide http://msdn.microsoft.com/en-us/library/ff647180.aspx up to creating the windows test app, i'm using a web project for this.
I have added the service reference to project and below is the code i'm attempting to execute:
public string SendXMLDocument(XmlDocument xDoc)
{
var message = Message.CreateMessage(MessageVersion.Soap11, "Request_for_action", new XmlNodeReader(xDoc));
var factory = new ChannelFactory<IActionServiceLibrary>("IMMS.ActionsServiceLibrary.IActionServiceLibrary");
var channel = factory.CreateChannel();
var response = channel.Request(message);
channel.Close();
return response.ToString(); //this should come back okay..
}
my library appconfig looks like:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
</appSettings>
<system.web>
<compilation debug="true" />
</system.web>
<!-- When deploying the service library project, the content of the config file must be added to the host's
app.config file. System.Configuration does not support config files for libraries. -->
<system.serviceModel>
<client>
<endpoint address="net.tcp://localhost:8080/ActionService/" binding="netTcpBinding"
bindingConfiguration="NetTcpBinding_IActionServiceLibrary" contract="IMMS.ActionsServiceLibrary.IActionServiceLibrary"
name="IMMS.ActionsServiceLibrary.IActionServiceLibrary">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
</client>
<services>
<service name="IMMS.ActionsServiceLibrary.ActionServiceLibrary">
<endpoint address="net.tcp://localhost:8080/ActionService/" binding="netTcpBinding" bindingConfiguration=""
contract="IMMS.ActionsServiceLibrary.IActionServiceLibrary">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint address="mex" binding="mexTcpBinding" bindingConfiguration=""
contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="net.tcp://localhost:8080/ActionService/" />
</baseAddresses>
</host>
</service>
</services>
<bindings>
<netTcpBinding>
<binding name="Action_Service" sendTimeout="00:01:00" transactionFlow="false"
listenBacklog="2147483647" maxBufferPoolSize="2147483647" maxBufferSize="2147483647"
maxReceivedMessageSize="2147483647" portSharingEnabled="false">
<reliableSession enabled="false" />
<security mode="None">
<transport clientCredentialType="None" protectionLevel="None" />
<message clientCredentialType="None" />
</security>
</binding>
<binding name="NetTcpBinding_IActionServiceLibrary" />
</netTcpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior name="">
<serviceMetadata httpGetEnabled="false" httpsGetEnabled="false" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
</configuration>
the app config for the service:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
</appSettings>
<system.web>
<compilation debug="true" />
</system.web>
<!-- When deploying the service library project, the content of the config file must be added to the host's
app.config file. System.Configuration does not support config files for libraries. -->
<system.serviceModel>
<client>
<endpoint address="net.tcp://localhost:8080/ActionService/" binding="netTcpBinding"
bindingConfiguration="NetTcpBinding_IActionServiceLibrary" contract="IMMS.ActionsServiceLibrary.IActionServiceLibrary"
name="IMMS.ActionsServiceLibrary.IActionServiceLibrary">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
</client>
<services>
<service name="IMMS.ActionsServiceLibrary.ActionServiceLibrary">
<endpoint address="net.tcp://localhost:8080/ActionService/" binding="netTcpBinding" bindingConfiguration=""
contract="IMMS.ActionsServiceLibrary.IActionServiceLibrary">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint address="mex" binding="mexTcpBinding" bindingConfiguration=""
contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="net.tcp://localhost:8080/ActionService/" />
</baseAddresses>
</host>
</service>
</services>
<bindings>
<netTcpBinding>
<binding name="Action_Service" sendTimeout="00:01:00" transactionFlow="false"
listenBacklog="2147483647" maxBufferPoolSize="2147483647" maxBufferSize="2147483647"
maxReceivedMessageSize="2147483647" portSharingEnabled="false">
<reliableSession enabled="false" />
<security mode="None">
<transport clientCredentialType="None" protectionLevel="None" />
<message clientCredentialType="None" />
</security>
</binding>
<binding name="NetTcpBinding_IActionServiceLibrary" />
</netTcpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior name="">
<serviceMetadata httpGetEnabled="false" httpsGetEnabled="false" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
</configuration>
i get a name mismatch on the channel creation.
any help to point me in the right direction for transmitting a xml file through wcf would be great.
I found out that my config file was messed up after fixing the errors it works now.

The caller was not authenticated by the service

I am using WCF and found this error:
" The caller was not authenticated by the service."
I have used this code in client.config file:
<system.serviceModel>
<bindings>
<wsHttpBinding>
<binding name="WSDualHttpBinding_IReceiverController" closeTimeout="00:00:05"
openTimeout="00:00:05" receiveTimeout="00:10:00" sendTimeout="00:00:05"
bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard"
maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<reliableSession ordered="true" inactivityTimeout="00:10:00" />
<security mode="None">
<message clientCredentialType="Windows" negotiateServiceCredential="false" />
</security>
</binding>
<binding name="WSHttpBinding_IEMRProWCFService" />
</wsHttpBinding>
</bindings>
<client>
<endpoint address="http://pionbuggs-pc:4567/EMRProWCFService.svc"
binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IEMRProWCFService"
contract="EMRProWCFService.IEMRProWCFService" name="WSHttpBinding_IEMRProWCFService">
<identity>
<dns value="http://pionbuggs-pc:4567/EMRProWCFService.svc" />
</identity>
</endpoint>
</client>
</system.serviceModel>
And below is the code in the service.config file:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.web>
<compilation />
<httpRuntime maxRequestLength="2147483647" />
</system.web>
<system.serviceModel>
<services>
<service name="WCFService.EMRProWCFService">
<endpoint address="" binding="wsHttpBinding" contract="WCFService.IEMRProWCFService">
<identity>
<dns value="http://pionbuggs-pc:4567/EMRProWCFService.svc" />
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior>
<!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
<serviceMetadata httpGetEnabled="true" />
<!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information -->
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
<bindings>
<webHttpBinding>
<binding name="WebConfiguration" maxBufferSize="65536" maxReceivedMessageSize="2147483647" transferMode="Streamed">
</binding>
</webHttpBinding>
</bindings>
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true" />
<directoryBrowse enabled="true" />
</system.webServer>
</configuration>
Instead of using binding="wsHttpBinding", try using just a basic, changing you client endopint to:
<endpoint address="http://pionbuggs-pc:4567/EMRProWCFService.svc"
binding="basicHttpBinding" bindingConfiguration="WSHttpBinding_IEMRProWCFService"
contract="EMRProWCFService.IEMRProWCFService" name="WSHttpBinding_IEMRProWCFService">
and on your service to:
<endpoint address="" binding="basicHttpBinding" contract="WCFService.IEMRProWCFService">
The error is that you use advanced security that requires you to use authentication, unless there are security constrains that require it.
Here's some info about it:
BasicHttpBinding vs WsHttpBinding vs WebHttpBinding

WCF Going from Basic to wsHttpBinding

I have gotten my config to work correctly now, there was a mismatch between the actual file structure and the project structure in visual studio. Stupid silly mistake :)
However, now I have the issue of transitioning from basicHttpBinding to WsHttpBinding. This is the webconfig. As you can see I have changed the first endpoint to be of the type wsHttpBinding.
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<connectionStrings>
<add name="RENTIT05ConnectionString" connectionString="Data Source=rentit.itu.dk;Initial Catalog=RENTIT05;Persist Security Info=True;User ID=Rentit05db;Password=omitted" providerName="System.Data.SqlClient" />
<add name="RENTIT05Entities" connectionString="metadata=res://*/RentIt.csdl|res://*/RentIt.ssdl|res://*/RentIt.msl;provider=System.Data.SqlClient;provider connection string="Data Source=rentit.itu.dk;Initial Catalog=RENTIT05;Persist Security Info=True;User ID=Rentit05db;Password=omitted;MultipleActiveResultSets=True"" providerName="System.Data.EntityClient" />
</connectionStrings>
<system.web>
<httpRuntime executionTimeout="3600" maxRequestLength="10000000"/>
<compilation debug="true" targetFramework="4.0">
<assemblies>
<add assembly="System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
</assemblies>
</compilation>
<customErrors mode="Off" />
</system.web>
<system.serviceModel>
<services>
<service name="RentIt05.Services.Service" behaviorConfiguration="ServiceBehavior">
<endpoint address="RentIt05.Services.AgeRatingService" binding="wsHttpBinding" bindingConfiguration="wsHttpBinding" contract="RentIt05.Interfaces.IAgeRatingService"></endpoint>
<endpoint address="RentIt05.Services.CommentService" binding="basicHttpBinding" bindingConfiguration="RentItBinding" contract="RentIt05.Interfaces.ICommentService"></endpoint>
<endpoint address="RentIt05.Services.ItemService" binding="basicHttpBinding" bindingConfiguration="RentItBinding" contract="RentIt05.Interfaces.IItemService"></endpoint>
<endpoint address="RentIt05.Services.ItemTypeService" binding="basicHttpBinding" bindingConfiguration="RentItBinding" contract="RentIt05.Interfaces.IItemTypeService"></endpoint>
<endpoint address="RentIt05.Services.LabelService" binding="basicHttpBinding" bindingConfiguration="RentItBinding" contract="RentIt05.Interfaces.ILabelService"></endpoint>
<endpoint address="RentIt05.Services.LoginService" binding="basicHttpBinding" bindingConfiguration="RentItBinding" contract="RentIt05.Interfaces.ILoginService"></endpoint>
<endpoint address="RentIt05.Services.RatingService" binding="basicHttpBinding" bindingConfiguration="RentItBinding" contract="RentIt05.Interfaces.IRatingService"></endpoint>
<endpoint address="RentIt05.Services.SectionService" binding="basicHttpBinding" bindingConfiguration="RentItBinding" contract="RentIt05.Interfaces.ISectionService"></endpoint>
<endpoint address="RentIt05.Services.StateLogService" binding="basicHttpBinding" bindingConfiguration="RentItBinding" contract="RentIt05.Interfaces.IStateLogService"></endpoint>
<endpoint address="RentIt05.Services.StateService" binding="basicHttpBinding" bindingConfiguration="RentItBinding" contract="RentIt05.Interfaces.IStateService"></endpoint>
<endpoint address="RentIt05.Services.UserGroupService" binding="basicHttpBinding" bindingConfiguration="RentItBinding" contract="RentIt05.Interfaces.IUserGroupService"></endpoint>
<endpoint address="RentIt05.Services.UserService" binding="basicHttpBinding" bindingConfiguration="RentItBinding" contract="RentIt05.Interfaces.IUserService"></endpoint>
<endpoint address="RentIt05.Services.TransferService" binding="basicHttpBinding" bindingConfiguration="RentItBinding" contract="RentIt05.Interfaces.ITransferService"></endpoint>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="ServiceBehavior">
<serviceThrottling maxConcurrentCalls="1000" maxConcurrentSessions="1000" maxConcurrentInstances="1000"/>
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
<bindings>
<basicHttpBinding>
<binding name="RentItBinding" maxReceivedMessageSize="2147483647" maxBufferSize="2147483647" transferMode="StreamedRequest">
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
</binding>
</basicHttpBinding>
<wsHttpBinding>
<binding name="wsHttpBinding">
<security mode="Transport">
<transport clientCredentialType="None" />
</security>
</binding>
</wsHttpBinding>
</bindings>
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true" />
</system.webServer>
</configuration>
When I try to run this locally on localhost, I get the following error message:
Could not find a base address that matches scheme https for the endpoint with binding WSHttpBinding. Registered base address schemes are [http]..
I have found some artiles talking about IIS resolving multiple base addresses, but this is locally, so I don't know why it is not working.
Is there something I'm missing here? The config file works fine as long as I only use basicHttpBindings.
Any help will be greatly appreciated, tyvm!
Do you need security enabled? You have transport security enabled on the wsHttpBinding which will look for ssl. Your basicHttpBinding isn't using any. The error will go away if you set
<binding name="wsHttpBinding">
<security mode="None">
</security>
</binding>
Another option is to set up ssl on IIS.

Categories