110,533
社区成员
发帖
与我相关
我的任务
分享
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior name="ServiceCalculatorInt">
<serviceMetadata httpGetEnabled="true" httpGetUrl="http://localhost:8080/ServiceCaculatorInt/metadata" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
<behavior name="ServiceCalculatorReal">
<serviceMetadata httpGetEnabled="true" httpGetUrl="http://localhost:8080/ServiceCalculatorReal/metadata" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
</behaviors>
<services>
<service behaviorConfiguration="ServiceCalculatorInt"
name="TestWCF.ServiceCalculatorInt">
<endpoint address="http://localhost:8080/ServiceCalculatorInt/ServiceCalculatorInt" binding="wsHttpBinding" contract="TestWCF.ICalculatorInt">
</endpoint>
<endpoint address="http://localhost:8080/ServiceCaculatorInt/mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
<service behaviorConfiguration="ServiceCalculatorReal"
name="TestWCF.ServiceCalculatorReal">
<endpoint address="http://localhost:8080/ServiceCalculatorReal/ServiceCalculatorReal" binding="wsHttpBinding" contract="TestWCF.ICalculatorReal">
</endpoint>
<endpoint address="http://localhost:8080/ServiceCalculatorReal/mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
</services>
</system.serviceModel>
</configuration>
<?xml version="1.0"?>
<configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
<system.serviceModel>
<services>
<!--<service name="MyService" behaviorConfiguration="returnFaults">
<endpoint contract="IMyService" binding="wsHttpBinding"/>
</service>-->
<service name="Anrs.Service.AnrsService" behaviorConfiguration="returnFaults">
<endpoint contract = "Anrs.Service.IAnrsServiceContract1"
binding = "wsHttpBinding"
address = "http://localhost:4021/AnrsServiceByIIS/AnrsService/" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="returnFaults" >
<serviceMetadata httpGetEnabled="true"></serviceMetadata>
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
<system.web>
<compilation debug="true"/>
</system.web>
</configuration>
using System;
using System.ServiceModel;
using System.ServiceModel.Channels;
namespace Anrs.Service
{
class Program
{
static void Main(string[] args)
{
ServiceHost sh = new ServiceHost(typeof(AnrsService));
Binding wsHttpBinding = new WSHttpBinding();
sh.AddServiceEndpoint(typeof(IAnrsServiceContract1),
wsHttpBinding,
new Uri("http://localhost:8086/AnrsService/"));
sh.Open();
Console.Write("Press any key to exit");
Console.ReadLine();
sh.Close();
}
}
}