<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior name="">
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
</behaviors>
<services>
<service name="WindowsFormsControlLibrary2.WCFService" behaviorConfiguration="configerror">
<endpoint address="WindowsFormsControlLibrary2.WCFService" binding="basicHttpBinding" contract="WindowsFormsControlLibrary2.IWCFService">
<identity>
<dns value="https://bbs.csdn.net/topics/localhost" />
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="http://localhost:8733/Design_Time_Addresses/WindowsFormsControlLibrary2/WCFService/" />
</baseAddresses>
</host>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="configerror">
<serviceMetadata httpGetEnabled="true" />
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
</configuration>
try
{ //打開服務創建監聽,并開始監聽訊息
ServiceHost serviceHost = new ServiceHost(typeof(WCFService));
//需要using System.ServiceModel;
serviceHost.Open();
weblab.Text = "服務啟動正常";
}
catch (Exception ex)
{
weblab.Text = ex.Message;
}
在winfrom 添加一個wcf 服務讓他作為宿主 提供一個web介面,但是啟動open的時候 報錯有零個應用程式(非基礎結構)終結點
求大神幫幫忙 網上很多辦法都試過了
轉載請註明出處,本文鏈接:https://www.uj5u.com/net/107518.html
標籤:C#
下一篇:vs code中的Nuget求助
