i have deployed my wcf service on IIS.. Its giving me this error when I want to access its one of method "EndPoint Not Found" While locally its working fine for me and returning me data.
Here is my Web.config Bindings Information
<system.webServer>
<directoryBrowse enabled="false" />
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
<system.serviceModel>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
<services>
<service name="RTAService" behaviorConfiguration="WtfServiceBehaviour">
<endpoint address="" binding="webHttpBinding" bindingConfiguration="wtfSslBinding" behaviorConfiguration="WebHttpBehaviour" contract="IRTAService" />
<endpoint address="soap" binding="basicHttpBinding" contract="IRTAService"/>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
</services>
<bindings>
<webHttpBinding>
<binding name="wtfSslBinding" />
<binding name="streamedBinding"
maxBufferSize="65536"
maxReceivedMessageSize="2000000000"
transferMode="Streamed">
<readerQuotas maxDepth="500000000"
maxArrayLength="500000000" maxBytesPerRead="500000000"
maxNameTableCharCount="500000000" maxStringContentLength="500000000"/>
<security mode="None" />
</binding>
</webHttpBinding>
</bindings>
<behaviors>
<endpointBehaviors>
<behavior name="WebHttpBehaviour">
<webHttp helpEnabled="true" defaultBodyStyle="Wrapped" defaultOutgoingResponseFormat="Json"
automaticFormatSelectionEnabled="false" />
</behavior>
</endpointBehaviors>
<serviceBehaviors>
<behavior name="WtfServiceBehaviour">
<serviceDebug includeExceptionDetailInFaults="true" />
<serviceMetadata httpGetEnabled="true" />
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
Please tell me any work around for that.
I dont see endpoint defined any where . Your config should have something like this.`
<endpoint address="http://localhost:57800/Services.svc" binding="basicHttpBinding"
bindingConfiguration="BasicHttpBinding_IServices" contract="MYServices.IServices"
name="BasicHttpBinding_IServices" />
Related
i have a server with wcf soap services. With simple httpbinding configuration everything worked perfectly.
After I changed the web.config to custombinding I keep getting the same error :
The request message must be protected. This is required by an operation of the contract ('IMyServices','http://tempuri.org/'). The protection must be provided by the binding ('BasicHttpBinding','http://tempuri.org/').
This is my web.config :
<system.serviceModel>
<bindings>
<customBinding>
<binding name="MyBinding">
<textMessageEncoding messageVersion="Soap11WSAddressingAugust2004" />
<security authenticationMode="MutualCertificate" requireDerivedKeys="false"
messageProtectionOrder="SignBeforeEncrypt" messageSecurityVersion="WSSecurity10WSTrustFebruary2005WSSecureConversationFebruary2005WSSecurityPolicy11BasicSecurityProfile10" />
<httpTransport keepAliveEnabled="false" />
</binding>
</customBinding>
</bindings>
<services>
<service behaviorConfiguration="MyBehavior" name="NewWCF.MyServices">
<endpoint address="" binding="customBinding" bindingConfiguration="MyBinding"
name="wsHttpMembershipEndpoint" contract="NewWCF.IMyServices" />
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="http://10.130.111.111/NewWCF" />
</baseAddresses>
</host>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="MyBehavior">
<serviceCredentials>
<clientCertificate>
<certificate findValue="CN=Central-Gateway" x509FindType="FindBySubjectDistinguishedName" storeName="TrustedPeople" />
<authentication revocationMode="NoCheck"
certificateValidationMode = "None"/>
</clientCertificate>
<serviceCertificate findValue="CN=MySrvTst" x509FindType="FindBySubjectDistinguishedName" storeName="My" storeLocation="LocalMachine" />
</serviceCredentials>
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
<serviceSecurityAudit serviceAuthorizationAuditLevel="SuccessOrFailure"
messageAuthenticationAuditLevel="SuccessOrFailure" />
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
lang-xml -->
Both certificates appear correctly in mmc.exe
I try to test it through a browser calling .svc path , should it work that way or does it fail because of the certificates ?
Is there a way to see a more detailed error?
What can be the problem?
Thanks in advance,
Brian.
I try to connect to another WCF server use proxy which using basicHttpBinding /customBinding for binding on my .net 4.0 but it doen't work :Server Error in '/' Application
my web.config file :
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0" />
</system.web>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="ServicesSoap">
<security mode="Transport" />
</binding>
<binding name="ServicesSoap1" />
</basicHttpBinding>
<customBinding>
<binding name="ServicesSoap12">
<textMessageEncoding messageVersion="Soap12" />
<httpsTransport />
</binding>
</customBinding>
</bindings>
<client>
<endpoint address="https://Test.com/LineTest/services.asmx"
binding="basicHttpBinding" bindingConfiguration="ServicesSoap"
contract="Test.ServicesSoap" name="ServicesSoap" />
<endpoint address="https://Test.com//LineTest/services.asmx"
binding="customBinding" bindingConfiguration="ServicesSoap12"
contract="Test.ServicesSoap" name="ServicesSoap12" />
</client>
<behaviors>
<serviceBehaviors>
<behavior name="">
<serviceMetadata httpGetEnabled="true" httpGetBinding="true"/>
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name="restBehavior">
<webHttp helpEnabled="true" />
</behavior>
</endpointBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" aspNetCompatibilityEnabled="true" />
<services>
<service name="WCFServerForMobile.WCFServerForAlineTest">
<endpoint name="ServerForAlineTest" contract="WCFServerForMobile.WCFServerForAlineTest" binding="wsHttpBinding" address="AlineTest" behaviorConfiguration="restBehavior"></endpoint>
</service>
</services>
</system.serviceModel>
</configuration>
`
Is there any way to solve that problem
httpGetBinding does not accept boolean but Binding. You should put your binding name instead.
Instead of:
<serviceMetadata httpGetEnabled="true" httpGetBinding="true"/>
Use:
<serviceMetadata httpGetEnabled="true" httpGetBinding="basicHttpBinding"/>
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>
I am having 2 app.config files on working for https access and another for http access, if i am having two option button one for http and another for https, if user select 1st option i.e http how i can store inside C:\program files while installing my application and refer my application to use only httpsapp.config file and not httpapp.config file.
Or how i can make my app.config file to work both for https as well as http.
Below is my app.config file while is currently working for http
<system.serviceModel>
<standardEndpoints />
<bindings>
<webHttpBinding>
<binding name="Bind1" crossDomainScriptAccessEnabled="true" maxReceivedMessageSize="900000" maxBufferSize="900000" />
</webHttpBinding>
</bindings>
<services>
<service name="PeripheralServiceImpl" behaviorConfiguration="SvcBhvr">
<endpoint address="" binding="webHttpBinding" behaviorConfiguration="EndPBhvr" bindingConfiguration="Bind1" contract="Server.Contract.IPeripheralService">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="http://localhost:18732/Peripheral/" />
</baseAddresses>
</host>
</service>
</services>
<behaviors>
<endpointBehaviors>
<behavior name="EndPBhvr">
<webHttp helpEnabled="true" defaultOutgoingResponseFormat="Json" faultExceptionEnabled="false" defaultBodyStyle="Wrapped" />
</behavior>
</endpointBehaviors>
<serviceBehaviors>
<behavior name="SvcBhvr">
<serviceMetadata httpGetEnabled="false" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment aspNetCompatibilityEnabled="false" />
</system.serviceModel>
And app.config working in https
<system.serviceModel>
<standardEndpoints />
<serviceHostingEnvironment aspNetCompatibilityEnabled="true"/>
<bindings>
<basicHttpBinding>
<binding name ="soapBinding">
<security mode="Transport">
<transport clientCredentialType="None"/>
</security>
</binding>
</basicHttpBinding>
<webHttpBinding>
<!--<binding name="httpBinding">-->
<binding name="Bind1" crossDomainScriptAccessEnabled="true" maxReceivedMessageSize="900000" maxBufferSize="900000" >
<security mode="Transport">
<transport clientCredentialType="None"/>
</security>
</binding>
</webHttpBinding>
</bindings>
<services>
<service name="PeripheralServiceImpl" behaviorConfiguration="SvcBhvr">
<host>
<baseAddresses>
<add baseAddress="https://localhost:18732/Peripheral/" />
</baseAddresses>
</host>
<endpoint address="https://localhost:18732/Peripheral/" binding="webHttpBinding" behaviorConfiguration="EndPBhvr" bindingConfiguration="Bind1"
contract="Server.Contract.IPeripheralService">
</endpoint>
<endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange" />
</service>
</services>
<behaviors>
<endpointBehaviors>
<behavior name="EndPBhvr">
<webHttp />
</behavior>
</endpointBehaviors>
<serviceBehaviors>
<behavior name="SvcBhvr">
<serviceMetadata httpsGetEnabled="true" httpGetEnabled="false" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
Anyone can help me out?
You can use a single config file for http and https, by defining the base address for each one.
I just tried this and it is working fine :
<system.serviceModel>
<services>
<service name="MyTest.MyService" behaviorConfiguration="ServiceBehavior">
<host>
<baseAddresses>
<add baseAddress="http://localhost:80/WCFtest/service.svc" />
<add baseAddress="https://localhost:443/WCFtest/service.svc" />
</baseAddresses>
</host>
<endpoint address="/soap" binding="basicHttpBinding" contract="MyTest.IMathService" />
<endpoint address="/rest" binding="webHttpBinding" contract="MyTest.IMyService" behaviorConfiguration="REST" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="ServiceBehavior">
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name="REST">
<webHttp />
</behavior>
</endpointBehaviors>
</behaviors>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
</system.serviceModel>
I'm trying to use WCF 4 to set up a RESTful web service. I'd like the service to be accessible both using HTTP and HTTPS. By default the service is created with the following configuration which works for http but not https:
<system.serviceModel>
<behaviors>
<endpointBehaviors>
<behavior>
<webHttp helpEnabled="true" />
</behavior>
</endpointBehaviors>
</behaviors>
<protocolMapping>
<add scheme="http" binding="webHttpBinding" />
</protocolMapping>
</system.serviceModel>
I can then turn on HTTPS for the service by changing the configuration slightly to this:
<system.serviceModel>
<behaviors>
<endpointBehaviors>
<behavior>
<webHttp helpEnabled="true" />
</behavior>
</endpointBehaviors>
</behaviors>
<bindings>
<webHttpBinding >
<binding name="SecureWebBinding" >
<security mode="Transport"></security>
</binding>
</webHttpBinding>
</bindings>
<protocolMapping>
<add scheme="http" binding="webHttpBinding" bindingConfiguration="SecureWebBinding"/>
</protocolMapping>
</system.serviceModel>
My question is how do I get the service working with both?
You should try to create two separate end-points. For example,
<system.serviceModel>
<services>
<service name="MyNameSpace.MyService">
<endpoint address="https://www.example.com/MyService.svc"
binding="wsHttpBinding" bindingConfiguration="SecureWebBinding"
contract="MyNameSpace.IMyContract" />
<endpoint address="http://www.example.com/MyService.svc"
binding="basicHttpBinding"
contract="MyNameSpace.IMyContract" />
</service>
<bindings>
<webHttpBinding >
<binding name="SecureWebBinding" >
<security mode="Transport"></security>
</binding>
</webHttpBinding>
</bindings>
</services>
</system.serviceModel>