Biztalk WCF service publishing wizard - wcf

I have exposed a schema as a WCFService.
But when I browse the .svc file, it is taking me to the WSDL file. Any one knows the reason.
web.config file:
<behaviors>
<serviceBehaviors>
<behavior name="ServiceBehaviorConfiguration">
<serviceDebug httpHelpPageEnabled="true" httpsHelpPageEnabled="false" includeExceptionDetailInFaults="false" />
<serviceMetadata httpsGetEnabled="true" />
</behavior>
</serviceBehaviors>
<!--<endpointBehaviors><behavior name="sharedSecretClientCredentials"><transportClientEndpointBehavior><tokenProvider><sharedSecret issuerName="owner" issuerSecret="ABCD" /><sharedAccessSignature keyName="RootManageSharedAccessKey" key="ABCD" /></tokenProvider></transportClientEndpointBehavior><serviceRegistrySettings discoveryMode="Public" /><btsWsdlExporter btsServiceDescriptionLocation="ServiceDescription.xml" debug="false" isRelay="false" /></behavior><behavior name="sharedSecretClientCredentialsMex"><transportClientEndpointBehavior><tokenProvider><sharedSecret issuerName="owner" issuerSecret="ABCD" /><sharedAccessSignature keyName="RootManageSharedAccessKey" key="ABCD" /></tokenProvider></transportClientEndpointBehavior><serviceRegistrySettings discoveryMode="Public" /></behavior></endpointBehaviors>-->
</behaviors>
<services>
<!-- Note: the service name must match the configuration name for the service implementation. -->
<service name="Microsoft.BizTalk.Adapter.Wcf.Runtime.BizTalkServiceInstance" behaviorConfiguration="ServiceBehaviorConfiguration">
<!--<endpoint name="HttpMexEndpoint" address="mex" binding="mexHttpBinding" bindingConfiguration="" contract="IMetadataExchange" />-->
<endpoint name="HttpsMexEndpoint" address="mex" binding="mexHttpBinding" bindingConfiguration="" contract="IMetadataExchange" />
<!--<endpoint name="RelayEndpoint" address="sb://test01.servicebus.windows.net/EchoServiceNetTcp/" binding="netTcpRelayBinding" bindingNamespace="http://tempuri.org/" bindingConfiguration="RelayEndpointConfig" behaviorConfiguration="sharedSecretClientCredentials" contract="Microsoft.BizTalk.Adapter.Wcf.Runtime.ITwoWayAsyncVoid" />-->
<!--<endpoint name="MexEndpoint" address="https://test01.servicebus.windows.net/EchoServiceNetTcp/Mex" binding="ws2007HttpRelayBinding" bindingNamespace="http://tempuri.org/" bindingConfiguration="RelayEndpointConfigMex" behaviorConfiguration="sharedSecretClientCredentialsMex" contract="IMetadataExchange" />-->
</service>
</services>

Set the httpsHelpPageEnabled property to true since you're trying to access that page on the HTTPS protocol.

Related

AddressFilter mismatch at the EndpointDispatcher

Have a WCF service that I am trying to add configuration for REST to. Keep getting the AddressFilter mismatch error. I have tried all the suggestions and gone over the addresses several times but I must be missing something in my configuration. Was hoping someone with some more experience with REST could see what I am missing here.
My service configuration is the following:
<behaviors>
<serviceBehaviors>
<behavior>
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="true"/>
<serviceThrottling maxConcurrentCalls="200" maxConcurrentSessions="200" maxConcurrentInstances="200"/>
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name="webBehavior">
<webHttp />
</behavior>
</endpointBehaviors>
</behaviors>
<services>
<service name="www.parinc.com.PARToolkit">
<endpoint address="" binding="wsHttpBinding" contract="IPARToolkit"/>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
<endpoint address="rest" binding="webHttpBinding" contract="IPARToolkit" behaviorConfiguration="webBehavior" />
<host>
<baseAddresses>
<add baseAddress="http://localhost:86/" />
</baseAddresses>
</host>
</service>
</services>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true"/>
<protocolMapping>
<add scheme="http" binding="webHttpBinding" />
</protocolMapping>
The contract is set up as:
[OperationContract]
[WebInvoke(UriTemplate = "GetApps?authKey1={authKey1}&authKey2={authKey2}", RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
string GetApps(string authKey1, string authKey2);
But when I try calling the service as follows (without the spaces I put in http to get the url to post here) I get the AddressFilter mismatch error:
"http://localhost:86/WebServices/PARToolkit.svc/rest/GetApps?authKey1=12345&authKey2=56789"
if you host the service in IIS, then remove the 'rest' in your address. e.g.
h t t p://localhost:86/WebServices/PARToolkit.svc/GetApps?authKey1=12345&authKey2=56789
and also, in service configuration, no need for address in endpoint. e.g.
<endpoint address="" binding="webHttpBinding" contract="IPARToolkit" behaviorConfiguration="webBehavior" />
and remove the baseAddresses sections.

Protobuf-net wcf response

I am trying use protobuf-net serialization with wcf
I have added the necessary configuration settings on client app.config and server web.config, decorated objects and the service interface.
I am using fiddler to examine the request and response. The request is using proto serialization but the response from the wcf service uses datacontractserializer.
I am able to serialize and deserialize the onjects outside the wcf service.
Any suggestions on what I could be doing wrong?
Thanks in advance
#Marc Gravell - Would yo be able to help with this? I have been able to configure Proto Serialization without issues before but I am running into issues this time. Below are the app.config(relevant portions) and web.config
Web.config
<extensions>
<behaviorExtensions>
<add name="protobuf" type="ProtoBuf.ServiceModel.ProtoBehaviorExtension, protobuf-net" />
</behaviorExtensions>
</extensions>
<behavior name="ProtoLargeDataEndpointBehavior">
<dataContractSerializer maxItemsInObjectGraph="2147483647" />
<protobuf />
</behavior>
<behavior name="LargeDataEndpointBehavior">
<service name="EOG.Modules.Cashflows.DataServices.CashflowAcrossStreamsService" behaviorConfiguration="DebugServiceBehavior">
<endpoint address="" binding="netTcpBinding" bindingConfiguration="InsecureTcp" behaviorConfiguration="LargeDataEndpointBehavior" contract="EOG.Modules.Cashflows.Common.Interfaces.ICashflowAcrossStreamsService" />
<endpoint address="mex" binding="mexTcpBinding" contract="IMetadataExchange" />
<endpoint address="proto" binding="netTcpBinding" bindingConfiguration="InsecureTcp" behaviorConfiguration="ProtoLargeDataEndpointBehavior" contract="EOG.Modules.Cashflows.Common.Interfaces.ICashflowAcrossStreamsService" />
<endpoint address="" binding="basicHttpBinding" bindingConfiguration="basicHttp" behaviorConfiguration="LargeDataEndpointBehavior" contract="EOG.Modules.Cashflows.Common.Interfaces.ICashflowAcrossStreamsService" />
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
<endpoint address="proto" binding="basicHttpBinding" bindingConfiguration="basicHttp" behaviorConfiguration="ProtoLargeDataEndpointBehavior" contract="EOG.Modules.Cashflows.Common.Interfaces.ICashflowAcrossStreamsService" />
</service>
App.config
<endpointBehaviors>
<behavior name="proto">
<protobuf />
</behavior>
<behavior name="LargeDataEndpointBehavior">
<dataContractSerializer maxItemsInObjectGraph="2147483647" />
</behavior>
<behavior name="ServiceBehavior">
<dataContractSerializer maxItemsInObjectGraph="2147483647" />
</behavior>
<behavior name="ProtoServiceBehavior">
<dataContractSerializer maxItemsInObjectGraph="2147483647" />
<protobuf />
</behavior>
</endpointBehaviors>
<extensions>
<behaviorExtensions>
<add name="protobuf" type="ProtoBuf.ServiceModel.ProtoBehaviorExtension, protobuf-net" />
</behaviorExtensions>
</extensions>
<endpoint address="http://server_name/iEconLiteServices/CashflowService.svc/proto" behaviorConfiguration="ProtoServiceBehavior" binding="basicHttpBinding" bindingConfiguration="basicHttp" contract="EOG.Modules.Cashflows.Common.Interfaces.ICashflowAcrossStreamsService" />
Below is a screenshot from fiddler that shows the request being serialized in proto and the response with Datacontractserializer.
https://drive.google.com/file/d/0B1IidY-dzmRLYV9vdDNaTm4wNzg/edit?usp=sharing
Any insight would be appreciated.
The issue turned out to be that the Contract method was returning a type of object instead of a specific type.

WCF TestClient Error if calling Get() methods

I'm dealing with a problem with WCF Testing. I have a CategorieService WCF service.. See the image http://i.stack.imgur.com/1Wbg1.jpg sharing it through netTcpBinding Everything it's ok(all methods are being called properly) except the GetAll() GetById() methods. It throws an exception... See the details http://i.stack.imgur.com/I60vt.jpg
Here is the App.config file
<system.serviceModel>
<diagnostics>
<messageLogging logEntireMessage="true" logMalformedMessages="true"
logMessagesAtTransportLevel="true" />
<endToEndTracing activityTracing="true" />
</diagnostics>
<services>
<service name="Services.CategorieService">
<clear />
<endpoint binding="mexHttpBinding" contract="IMetadataExchange"
listenUriMode="Explicit">
<identity>
<dns value="localhost" />
<certificateReference storeName="My" storeLocation="LocalMachine"
x509FindType="FindBySubjectDistinguishedName" />
</identity>
</endpoint>
<endpoint address="net.tcp://localhost:8888/myservice" binding="netTcpBinding"
bindingConfiguration="" contract="Services.ICategorieService" />
<host>
<baseAddresses>
<add baseAddress="http://localhost:8732/Service1/" />
</baseAddresses>
</host>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior>
<serviceMetadata httpGetEnabled="True"/>
<serviceDebug includeExceptionDetailInFaults="False" />
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
I was using POCO entities with a DbContext connection. The ProxyCreation option must be set to this.Configuration.ProxyCreationEnabled = false;

WCF 4 and multiple endpoint bindings

I am yrying to have the same contract and service to be exposed as both basicHttpBinding and webHttpBinding to be able to do a POST call. somehow it's NEVER seeing the endpoint for webHttpBinding when I look at the wsdl. What I am doing wrong?
<system.serviceModel>
<services>
<service name="MyService">
<endpoint address =""
binding="basicHttpBinding"
name="EndpointBasic"
contract="IMyService"/>
<endpoint address ="PostMethod"
binding="webHttpBinding"
name="EndpointJson"
contract="IMyService"/>
<host>
<baseAddresses>
<add baseAddress ="http://localhost/WebsiteName/MyService.svc"/>
</baseAddresses>
</host>
</service>
</services>
<bindings>
<basicHttpBinding>
<binding name="basicBinding" />
</basicHttpBinding>
<webHttpBinding>
<binding name="Postbinding"
maxBufferSize="65536"
maxReceivedMessageSize="2000000000"
transferMode="Streamed">
</binding>
</webHttpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior name="">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name="JsonBehavior">
<webHttp defaultOutgoingResponseFormat="Json" />
</behavior>
</endpointBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
Thanks!
I have the following service element entry which works for both SOAP and REST:
<service name="XMLService.RestAndSoapService" behaviorConfiguration="default">
<endpoint address="" behaviorConfiguration="web" binding="webHttpBinding" bindingConfiguration="RestBinding" name="SampleService" contract="XMLService.IRestAndSoapService" />
<endpoint address="soap" binding="basicHttpBinding" bindingConfiguration="noSecurity" contract="XMLService.IRestAndSoapService" />
</service>
Points to note in your config:
In your service element your contract and service name are not fully qualified. Make sure that they are fully qualified ie. includes the namespace along with the interface.
You have not specified the bindingConfiguration as "Postbinding" for webHttpEndpoint and "basicBinding" for basicHttpBinding endpoint
So with the above changes your config might look as shown below:
<service name="namespace.MyService">
<endpoint address =""
bindingConfiguration="basicBinding"
binding="basicHttpBinding"
name="EndpointBasic"
contract="namespace.IMyService"/>
<endpoint address ="PostMethod"
bindingConfiguration="Postbinding"
binding="webHttpBinding"
name="EndpointJson"
contract="namespace.IMyService"/>
<host>
<baseAddresses>
<add baseAddress ="http://localhost/WebsiteName/MyService.svc"/>
</baseAddresses>
</host>
</service>

Server side WCF (.svc) service stops working after exception

I'm using a duplex ReliableSecureProfile in WCF and the server will stop listening to new requests if an exception occurs on any client.
How can I make the server more resilient to failures that happen to any single client? Everything works again if I restart the server or redeploy
My client code looks like this:
CustomBinding rspBinding = new CustomBinding();
rspBinding.Elements.Add(new ReliableSessionBindingElement());
rspBinding.Elements.Add(new MakeConnectionBindingElement());
rspBinding.Elements.Add(new TextMessageEncodingBindingElement());
rspBinding.Elements.Add(new HttpTransportBindingElement());
DuplexChannelFactory<IProcessDataDuplex> channelFactory =
new DuplexChannelFactory<IProcessDataDuplex>
(new CallbackHandler(), rspBinding, serviceAddress);
//
// The problem always occurs on this line.
//
reusableSW = new LC.Utils.WCF.ServiceWrapper<IProcessDataDuplex>(channelFactory);
My web.config looks like this:
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior name="rspServiceBehavior">
<serviceMetadata httpGetEnabled="true" policyVersion="Policy15" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
<behavior name="">
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
<useRequestHeadersForMetadataAddress>
<defaultPorts>
<add scheme="http" port="80" />
<add scheme="https" port="443" />
</defaultPorts>
</useRequestHeadersForMetadataAddress>
</behavior>
</serviceBehaviors>
</behaviors>
<bindings>
<customBinding>
<!-- Reliable Secure Profile -->
<binding name="rspBinding">
<reliableSession />
<MakeConnectionBindingElement/>
<textMessageEncoding />
<httpTransport />
</binding>
</customBinding>
<netTcpBinding>
<binding portSharingEnabled="true" >
<security mode="None" />
</binding>
</netTcpBinding>
</bindings>
<extensions>
<bindingElementExtensions>
<!-- Reliable Secure Profile -->
<add name="MakeConnectionBindingElement" type="Microsoft.Samples.ReliableSecureProfile.MakeConnectionElement, Microsoft.Samples.ReliableSecureProfile.MakeConnectionChannel" />
</bindingElementExtensions>
</extensions>
<services>
<!-- Reliable Secure Profile -->
<service behaviorConfiguration="rspServiceBehavior" name="Microsoft.Samples.ReliableSecureProfile.RSPService">
<endpoint binding="customBinding" bindingConfiguration="rspBinding"
contract="Microsoft.Samples.ReliableSecureProfile.IProcessDataDuplex"
listenUriMode="Explicit">
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" bindingConfiguration=""
contract="IMetadataExchange" />
<host>
</host>
</service>
<!--<service name="WcfTcpTest.Service1" >
<host>
<baseAddresses>
<add baseAddress="net.tcp://localhost:1337/Service1/" />
</baseAddresses>
</host>
<endpoint address="" binding="netTcpBinding" contract="WcfTcpTest.IService1">
<identity>
<dns value="localhost"/>
</identity>
</endpoint>
<endpoint address="mex" binding="mexTcpBinding" contract="IMetadataExchange"/>
</service>-->
</services>
<protocolMapping>
<clear/>
<!-- removes all defaults which you may or may not want. -->
<!-- If not, use <remove scheme="http" /> -->
<add scheme="http" binding="customBinding" bindingConfiguration="rspBinding"/>
</protocolMapping>
<serviceHostingEnvironment
aspNetCompatibilityEnabled="false"
multipleSiteBindingsEnabled="true" />
</system.serviceModel>
I can't reproduce this issue anymore (where the server simply stops responding). I think the issue is related to VS2010's desire to catch handled exceptions and stop all threads as explained here:
Getting an Unhandled Exception in VS2010 debugger even though the exception IS handled