110,534
社区成员
发帖
与我相关
我的任务
分享
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior name="test">
<serviceMetadata httpGetEnabled="true" httpGetUrl="http://127.0.0.1:8888/mytest/"/>
</behavior>
</serviceBehaviors>
</behaviors>
<services>
<service behaviorConfiguration="test" name="WcfService1.Service1">
<endpoint address="http://127.0.0.1:8888/mytest" binding="wsHttpBinding" contract="WcfService1.IService1" />
</service>
</services>
</system.serviceModel>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
</configuration>
Form里的代码:
private void button1_Click(object sender, EventArgs e)
{
ServiceHost host = new ServiceHost(typeof(WcfService1.Service1));
host.Open();
}