我在WPF应用程序中托管了一个名为" FaceDetectionService"的WCF服务。它实现了IFaceDetectionService接口。我在MainWindow的构造函数中使用以下代码托管了该服务:
ServiceHost servicehostFaceDetectionRequired = new ServiceHost(typeof(FaceDetectionService));
servicehostFaceDetectionRequired.Open();
这是我的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>
问题:启动应用程序后,我无法浏览到我在App.config中提供的URI。我为自己托管的Windows窗体应用程序WCF服务执行了相同的步骤,它正在运行。请有人帮忙。
由于
答案 0 :(得分:0)
现在正在工作。我在关闭窗口之前关闭了服务。