Its working now. I was closing the service before Closing the window.
Self hosted wcf service inside wpf application - can't call / run through browser
Question
I have hosted a WCF service inside the WPF application called "FaceDetectionService" which implements the interface IFaceDetectionService. I have hosted the service using following code inside MainWindow's constructor:
ServiceHost servicehostFaceDetectionRequired = new ServiceHost(typeof(FaceDetectionService));
servicehostFaceDetectionRequired.Open();
Here's my app.config:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Microsoft.Kinect" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.8.0.0" newVersion="1.8.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior name="">
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
</behaviors>
<services>
<service name="FacialRecognitionTest.FaceDetectionService">
<endpoint address="" binding="basicHttpBinding" contract="FacialRecognitionTest.IFaceDetectionService">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="http://localhost:8734/Design_Time_Addresses/FacialRecognitionTest/FaceDetectionService/" />
</baseAddresses>
</host>
</service>
</services>
</system.serviceModel>
</configuration>
Problem: After starting the application I can't browse to my URI which I gave in App.config. I did same steps for my self-hosted WCF Service for Windows Form Application and it is working. Can anybody help please.
Thanks
Solution
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow