WCF路由服务
代碼下載: 鏈接:https://pan.baidu.com/s/1i76Ht0lMWmosaCrDjaA2cA 密碼:muj1
1.新建類庫 Service.Interface using System.ServiceModel; namespace Artech.RoutingServiceDemo.Service.Interface {[ServiceContract(Namespace="http://www.artech.com/")]public interface IHello{[OperationContract]string SayHello(string userName);}[ServiceContract(Namespace = "http://www.artech.com/")]public interface IGoodbye{[OperationContract]string SayGoodbye(string userName);} } 2.新建web項目 TestService using Artech.RoutingServiceDemo.Service.Interface; namespace Service {public class HelloService: IHello{public string SayHello(string userName){return string.Format("Hello, {0}", userName);}}public class GoodbyeService : IGoodbye{public string SayGoodbye(string userName){return string.Format("Goodbye, {0}", userName);}}} using System; using System.Collections.Generic; using System.Linq; using System.ServiceModel; using System.ServiceModel.Channels; using System.Web;namespace TestWcf {[ServiceContract]public interface IService{[OperationContract]string DoWork();}public class Service2 : IService{public string DoWork(){return "你妹!";}}/// <summary>/// 用于調用服務的類 /// </summary>public class MyClient : ClientBase<IService>, IService{public MyClient(Binding binding, EndpointAddress edpAddress): base(binding, edpAddress){}/// <summary>/// 調用服務端函數/// </summary>/// <returns></returns>public string DoWork(){return base.Channel.DoWork();}} } 3.testservice的web.config <system.serviceModel><!--添加此節點,否則出現405錯誤--><bindings><wsHttpBinding><binding name="NoneSecurity" maxBufferPoolSize="12000000" maxReceivedMessageSize="12000000" useDefaultWebProxy="false"><readerQuotas maxStringContentLength="12000000" maxArrayLength="12000000"/><security mode="None"/></binding></wsHttpBinding></bindings><behaviors><serviceBehaviors><behavior name="metadataBehavior"><!-- 為避免泄漏元數據信息,請在部署前將以下值設置為 false --><serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/><!-- 要接收故障異常詳細信息以進行調試,請將以下值設置為 true。在部署前設置為 false 以避免泄漏異常信息 --><serviceDebug includeExceptionDetailInFaults="false"/></behavior><behavior name="routingBehavior"><routing filterTableName="greetingFilterTable"/></behavior></serviceBehaviors></behaviors><services><service name="TestWcf.Service2" behaviorConfiguration="metadataBehavior"><endpoint address="" binding="wsHttpBinding" contract="TestWcf.IService" bindingConfiguration="NoneSecurity"/><endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/></service><service name="Service.HelloService"><endpoint binding="ws2007HttpBinding" contract="Artech.RoutingServiceDemo.Service.Interface.IHello"/></service><service name="Service.GoodbyeService"><endpoint binding="ws2007HttpBinding" contract="Artech.RoutingServiceDemo.Service.Interface.IGoodbye"/></service><service behaviorConfiguration="routingBehavior" name="System.ServiceModel.Routing.RoutingService"><endpoint binding="ws2007HttpBinding" contract="System.ServiceModel.Routing.IRequestReplyRouter"/></service></services><client><endpoint name="helloService" address="http://localhost:65515/WcfService/HelloService.svc" binding="ws2007HttpBinding" contract="*"/><endpoint name="goodbyeService" address="http://localhost:65515/WcfService/GoodbyeService.svc" binding="ws2007HttpBinding" contract="*"/></client><routing><filters><filter name="Address4HelloService" filterType="EndpointAddress" filterData="http://localhost:65515/WcfService/HelloService.svc"/><filter name="Address4GoodbyeService" filterType="EndpointAddress" filterData="http://localhost:65515/WcfService/GoodbyeService.svc"/></filters><filterTables><filterTable name="greetingFilterTable"><add filterName="Address4HelloService" endpointName="helloService"/><add filterName="Address4GoodbyeService" endpointName="goodbyeService"/></filterTable></filterTables></routing><!--無svc文件wcf服務激活--><serviceHostingEnvironment><serviceActivations><add relativeAddress="Service2.svc" service="TestWcf.Service2"/><add relativeAddress="WcfService/HelloService.svc" service="Service.HelloService"/><add relativeAddress="WcfService/GoodbyeService.svc" service="Service.GoodbyeService"/><!--, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35--><!--System.ServiceModel.Routing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35--><add relativeAddress="WcfService/GrettingService.svc" service="System.ServiceModel.Routing.RoutingService, System.ServiceModel.Routing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/></serviceActivations></serviceHostingEnvironment></system.serviceModel> 4.新建testwcfweb項目 using Artech.RoutingServiceDemo.Service.Interface; using System; using System.Collections.Generic; using System.Linq; using System.ServiceModel; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using TestWcf;namespace TestWcf {public partial class TestForm : System.Web.UI.Page{public void testnosvc(){EndpointAddress edpHttp = new EndpointAddress("http://localhost:65515/Service2.svc");MyClient client = new MyClient(new WSHttpBinding(SecurityMode.None), edpHttp);Response.Write(client.DoWork()+"<br/>");//Console.ReadKey(); }public void test2(){using (ChannelFactory<IHello> channelFactoryHello = new ChannelFactory<IHello>("helloService"))using (ChannelFactory<IGoodbye> channelFactoryGoodbye = new ChannelFactory<IGoodbye>("goodbyeService")){IHello helloProxy = channelFactoryHello.CreateChannel();IGoodbye goodbyeProxy = channelFactoryGoodbye.CreateChannel();Response.Write(helloProxy.SayHello("Zhang San")+"<br/>");Response.Write(goodbyeProxy.SayGoodbye("Li Si")+ "<br/>");}}protected void Page_Load(object sender, EventArgs e){testnosvc();test2();}} } 5.testwcf的web.config <?xml version="1.0" encoding="utf-8"?> <!--有關如何配置 ASP.NET 應用程序的詳細信息,請訪問http://go.microsoft.com/fwlink/?LinkId=169433--> <configuration><configSections><!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 --></configSections><connectionStrings><add name="DefaultConnection" connectionString="Data Source=(LocalDb)\MSSQLLocalDB;AttachDbFilename=|DataDirectory|\aspnet-WebApplication18-20180807095436.mdf;Initial Catalog=aspnet-WebApplication18-20180807095436;Integrated Security=True" providerName="System.Data.SqlClient" /></connectionStrings><system.web><authentication mode="None" /><compilation debug="true" targetFramework="4.5" /><httpRuntime targetFramework="4.5" /><pages><namespaces><add namespace="System.Web.Optimization" /><add namespace="Microsoft.AspNet.Identity" /></namespaces><controls><add assembly="Microsoft.AspNet.Web.Optimization.WebForms" namespace="Microsoft.AspNet.Web.Optimization.WebForms" tagPrefix="webopt" /></controls></pages><membership><providers><!--已在此模板中禁用 ASP.NET 成員身份。請訪問以下鏈接 http://go.microsoft.com/fwlink/?LinkId=301889,以了解此模板中的 ASP.NET 成員身份支持--><clear /></providers></membership><profile><providers><!--已在此模板中禁用 ASP.NET 成員身份配置文件。請訪問以下鏈接 http://go.microsoft.com/fwlink/?LinkId=301889,以了解此模板中的 ASP.NET 成員身份支持--><clear /></providers></profile><roleManager><!--已在此模板中禁用 ASP.NET 成員身份角色。請訪問以下鏈接 http://go.microsoft.com/fwlink/?LinkId=301889,以了解此模板中的 ASP.NET 成員身份支持--><providers><clear /></providers></roleManager><!--如果要部署到具有多個 Web 服務器實例的云環境,則應將會話狀態模式從 "InProc" 更改為“自定義”。此外,還應將名為 "DefaultConnection" 的連接字符串更改為連接到SQL Server (包括 SQL Azure 和 SQL Compact)實例,而不是連接到 SQL Server Express 實例。--><sessionState mode="InProc" customProvider="DefaultSessionProvider"><providers><add name="DefaultSessionProvider" type="System.Web.Providers.DefaultSessionStateProvider, System.Web.Providers, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" connectionStringName="DefaultConnection" /></providers></sessionState><httpModules><add name="ApplicationInsightsWebTracking" type="Microsoft.ApplicationInsights.Web.ApplicationInsightsHttpModule, Microsoft.AI.Web" /></httpModules></system.web><system.webServer><modules><remove name="FormsAuthentication" /><remove name="ApplicationInsightsWebTracking" /><add name="ApplicationInsightsWebTracking" type="Microsoft.ApplicationInsights.Web.ApplicationInsightsHttpModule, Microsoft.AI.Web" preCondition="managedHandler" /></modules><validation validateIntegratedModeConfiguration="false" /></system.webServer><runtime><assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"><dependentAssembly><assemblyIdentity name="Newtonsoft.Json" culture="neutral" publicKeyToken="30ad4fe6b2a6aeed" /><bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" /></dependentAssembly><dependentAssembly><assemblyIdentity name="WebGrease" culture="neutral" publicKeyToken="31bf3856ad364e35" /><bindingRedirect oldVersion="0.0.0.0-1.5.2.14234" newVersion="1.5.2.14234" /></dependentAssembly><dependentAssembly><assemblyIdentity name="EntityFramework" publicKeyToken="b77a5c561934e089" /><bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" /></dependentAssembly><dependentAssembly><assemblyIdentity name="Microsoft.Owin" culture="neutral" publicKeyToken="31bf3856ad364e35" /><bindingRedirect oldVersion="0.0.0.0-3.0.1.0" newVersion="3.0.1.0" /></dependentAssembly><dependentAssembly><assemblyIdentity name="Microsoft.Owin.Security.OAuth" culture="neutral" publicKeyToken="31bf3856ad364e35" /><bindingRedirect oldVersion="0.0.0.0-3.0.1.0" newVersion="3.0.1.0" /></dependentAssembly><dependentAssembly><assemblyIdentity name="Microsoft.Owin.Security.Cookies" culture="neutral" publicKeyToken="31bf3856ad364e35" /><bindingRedirect oldVersion="0.0.0.0-3.0.1.0" newVersion="3.0.1.0" /></dependentAssembly><dependentAssembly><assemblyIdentity name="Microsoft.Owin.Security" culture="neutral" publicKeyToken="31bf3856ad364e35" /><bindingRedirect oldVersion="0.0.0.0-3.0.1.0" newVersion="3.0.1.0" /></dependentAssembly></assemblyBinding></runtime><system.codedom><compilers><compiler language="c#;cs;csharp" extension=".cs" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:6 /nowarn:1659;1699;1701" /><compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.VBCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:14 /nowarn:41008 /define:_MYTYPE=\"Web\" /optionInfer+" /></compilers></system.codedom><!--wcf配置--><system.serviceModel><!--添加此節點,否則出現405錯誤--><bindings><wsHttpBinding><binding name="NoneSecurity"maxBufferPoolSize="12000000" maxReceivedMessageSize="12000000" useDefaultWebProxy="false"><readerQuotas maxStringContentLength="12000000" maxArrayLength="12000000"/><security mode="None"/></binding></wsHttpBinding></bindings><behaviors><serviceBehaviors><behavior name="metadataBehavior"><!-- 為避免泄漏元數據信息,請在部署前將以下值設置為 false --><serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/><!-- 要接收故障異常詳細信息以進行調試,請將以下值設置為 true。在部署前設置為 false 以避免泄漏異常信息 --><serviceDebug includeExceptionDetailInFaults="false"/></behavior><behavior name="routingBehavior"><routing filterTableName="greetingFilterTable"/></behavior></serviceBehaviors><endpointBehaviors><behavior><clientVia viaUri="http://localhost:65515/WcfService/GrettingService.svc"/></behavior></endpointBehaviors></behaviors><!--<protocolMapping><add binding="wsHttpBinding" scheme="http" /></protocolMapping>--><services><!--<service behaviorConfiguration="metadataBehavior" name="TestWcf.Service2"><endpoint address="" binding="wsHttpBinding" bindingConfiguration="NoneSecurity"contract="TestWcf.IService" /><endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" /></service>--></services><client><endpoint name="helloService" address="http://localhost:65515/WcfService/HelloService.svc" binding="ws2007HttpBinding" contract="Artech.RoutingServiceDemo.Service.Interface.IHello"/><endpoint name="goodbyeService" address="http://localhost:65515/WcfService/GoodbyeService.svc" binding="ws2007HttpBinding" contract="Artech.RoutingServiceDemo.Service.Interface.IGoodbye"/></client><!--無svc文件wcf服務激活--><serviceHostingEnvironment><serviceActivations><!--<add relativeAddress="Service2.svc" service="TestWcf.Service2"/>--></serviceActivations></serviceHostingEnvironment></system.serviceModel> </configuration>
1.新建類庫 Service.Interface using System.ServiceModel; namespace Artech.RoutingServiceDemo.Service.Interface {[ServiceContract(Namespace="http://www.artech.com/")]public interface IHello{[OperationContract]string SayHello(string userName);}[ServiceContract(Namespace = "http://www.artech.com/")]public interface IGoodbye{[OperationContract]string SayGoodbye(string userName);} } 2.新建web項目 TestService using Artech.RoutingServiceDemo.Service.Interface; namespace Service {public class HelloService: IHello{public string SayHello(string userName){return string.Format("Hello, {0}", userName);}}public class GoodbyeService : IGoodbye{public string SayGoodbye(string userName){return string.Format("Goodbye, {0}", userName);}}} using System; using System.Collections.Generic; using System.Linq; using System.ServiceModel; using System.ServiceModel.Channels; using System.Web;namespace TestWcf {[ServiceContract]public interface IService{[OperationContract]string DoWork();}public class Service2 : IService{public string DoWork(){return "你妹!";}}/// <summary>/// 用于調用服務的類 /// </summary>public class MyClient : ClientBase<IService>, IService{public MyClient(Binding binding, EndpointAddress edpAddress): base(binding, edpAddress){}/// <summary>/// 調用服務端函數/// </summary>/// <returns></returns>public string DoWork(){return base.Channel.DoWork();}} } 3.testservice的web.config <system.serviceModel><!--添加此節點,否則出現405錯誤--><bindings><wsHttpBinding><binding name="NoneSecurity" maxBufferPoolSize="12000000" maxReceivedMessageSize="12000000" useDefaultWebProxy="false"><readerQuotas maxStringContentLength="12000000" maxArrayLength="12000000"/><security mode="None"/></binding></wsHttpBinding></bindings><behaviors><serviceBehaviors><behavior name="metadataBehavior"><!-- 為避免泄漏元數據信息,請在部署前將以下值設置為 false --><serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/><!-- 要接收故障異常詳細信息以進行調試,請將以下值設置為 true。在部署前設置為 false 以避免泄漏異常信息 --><serviceDebug includeExceptionDetailInFaults="false"/></behavior><behavior name="routingBehavior"><routing filterTableName="greetingFilterTable"/></behavior></serviceBehaviors></behaviors><services><service name="TestWcf.Service2" behaviorConfiguration="metadataBehavior"><endpoint address="" binding="wsHttpBinding" contract="TestWcf.IService" bindingConfiguration="NoneSecurity"/><endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/></service><service name="Service.HelloService"><endpoint binding="ws2007HttpBinding" contract="Artech.RoutingServiceDemo.Service.Interface.IHello"/></service><service name="Service.GoodbyeService"><endpoint binding="ws2007HttpBinding" contract="Artech.RoutingServiceDemo.Service.Interface.IGoodbye"/></service><service behaviorConfiguration="routingBehavior" name="System.ServiceModel.Routing.RoutingService"><endpoint binding="ws2007HttpBinding" contract="System.ServiceModel.Routing.IRequestReplyRouter"/></service></services><client><endpoint name="helloService" address="http://localhost:65515/WcfService/HelloService.svc" binding="ws2007HttpBinding" contract="*"/><endpoint name="goodbyeService" address="http://localhost:65515/WcfService/GoodbyeService.svc" binding="ws2007HttpBinding" contract="*"/></client><routing><filters><filter name="Address4HelloService" filterType="EndpointAddress" filterData="http://localhost:65515/WcfService/HelloService.svc"/><filter name="Address4GoodbyeService" filterType="EndpointAddress" filterData="http://localhost:65515/WcfService/GoodbyeService.svc"/></filters><filterTables><filterTable name="greetingFilterTable"><add filterName="Address4HelloService" endpointName="helloService"/><add filterName="Address4GoodbyeService" endpointName="goodbyeService"/></filterTable></filterTables></routing><!--無svc文件wcf服務激活--><serviceHostingEnvironment><serviceActivations><add relativeAddress="Service2.svc" service="TestWcf.Service2"/><add relativeAddress="WcfService/HelloService.svc" service="Service.HelloService"/><add relativeAddress="WcfService/GoodbyeService.svc" service="Service.GoodbyeService"/><!--, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35--><!--System.ServiceModel.Routing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35--><add relativeAddress="WcfService/GrettingService.svc" service="System.ServiceModel.Routing.RoutingService, System.ServiceModel.Routing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/></serviceActivations></serviceHostingEnvironment></system.serviceModel> 4.新建testwcfweb項目 using Artech.RoutingServiceDemo.Service.Interface; using System; using System.Collections.Generic; using System.Linq; using System.ServiceModel; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using TestWcf;namespace TestWcf {public partial class TestForm : System.Web.UI.Page{public void testnosvc(){EndpointAddress edpHttp = new EndpointAddress("http://localhost:65515/Service2.svc");MyClient client = new MyClient(new WSHttpBinding(SecurityMode.None), edpHttp);Response.Write(client.DoWork()+"<br/>");//Console.ReadKey(); }public void test2(){using (ChannelFactory<IHello> channelFactoryHello = new ChannelFactory<IHello>("helloService"))using (ChannelFactory<IGoodbye> channelFactoryGoodbye = new ChannelFactory<IGoodbye>("goodbyeService")){IHello helloProxy = channelFactoryHello.CreateChannel();IGoodbye goodbyeProxy = channelFactoryGoodbye.CreateChannel();Response.Write(helloProxy.SayHello("Zhang San")+"<br/>");Response.Write(goodbyeProxy.SayGoodbye("Li Si")+ "<br/>");}}protected void Page_Load(object sender, EventArgs e){testnosvc();test2();}} } 5.testwcf的web.config <?xml version="1.0" encoding="utf-8"?> <!--有關如何配置 ASP.NET 應用程序的詳細信息,請訪問http://go.microsoft.com/fwlink/?LinkId=169433--> <configuration><configSections><!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 --></configSections><connectionStrings><add name="DefaultConnection" connectionString="Data Source=(LocalDb)\MSSQLLocalDB;AttachDbFilename=|DataDirectory|\aspnet-WebApplication18-20180807095436.mdf;Initial Catalog=aspnet-WebApplication18-20180807095436;Integrated Security=True" providerName="System.Data.SqlClient" /></connectionStrings><system.web><authentication mode="None" /><compilation debug="true" targetFramework="4.5" /><httpRuntime targetFramework="4.5" /><pages><namespaces><add namespace="System.Web.Optimization" /><add namespace="Microsoft.AspNet.Identity" /></namespaces><controls><add assembly="Microsoft.AspNet.Web.Optimization.WebForms" namespace="Microsoft.AspNet.Web.Optimization.WebForms" tagPrefix="webopt" /></controls></pages><membership><providers><!--已在此模板中禁用 ASP.NET 成員身份。請訪問以下鏈接 http://go.microsoft.com/fwlink/?LinkId=301889,以了解此模板中的 ASP.NET 成員身份支持--><clear /></providers></membership><profile><providers><!--已在此模板中禁用 ASP.NET 成員身份配置文件。請訪問以下鏈接 http://go.microsoft.com/fwlink/?LinkId=301889,以了解此模板中的 ASP.NET 成員身份支持--><clear /></providers></profile><roleManager><!--已在此模板中禁用 ASP.NET 成員身份角色。請訪問以下鏈接 http://go.microsoft.com/fwlink/?LinkId=301889,以了解此模板中的 ASP.NET 成員身份支持--><providers><clear /></providers></roleManager><!--如果要部署到具有多個 Web 服務器實例的云環境,則應將會話狀態模式從 "InProc" 更改為“自定義”。此外,還應將名為 "DefaultConnection" 的連接字符串更改為連接到SQL Server (包括 SQL Azure 和 SQL Compact)實例,而不是連接到 SQL Server Express 實例。--><sessionState mode="InProc" customProvider="DefaultSessionProvider"><providers><add name="DefaultSessionProvider" type="System.Web.Providers.DefaultSessionStateProvider, System.Web.Providers, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" connectionStringName="DefaultConnection" /></providers></sessionState><httpModules><add name="ApplicationInsightsWebTracking" type="Microsoft.ApplicationInsights.Web.ApplicationInsightsHttpModule, Microsoft.AI.Web" /></httpModules></system.web><system.webServer><modules><remove name="FormsAuthentication" /><remove name="ApplicationInsightsWebTracking" /><add name="ApplicationInsightsWebTracking" type="Microsoft.ApplicationInsights.Web.ApplicationInsightsHttpModule, Microsoft.AI.Web" preCondition="managedHandler" /></modules><validation validateIntegratedModeConfiguration="false" /></system.webServer><runtime><assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"><dependentAssembly><assemblyIdentity name="Newtonsoft.Json" culture="neutral" publicKeyToken="30ad4fe6b2a6aeed" /><bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" /></dependentAssembly><dependentAssembly><assemblyIdentity name="WebGrease" culture="neutral" publicKeyToken="31bf3856ad364e35" /><bindingRedirect oldVersion="0.0.0.0-1.5.2.14234" newVersion="1.5.2.14234" /></dependentAssembly><dependentAssembly><assemblyIdentity name="EntityFramework" publicKeyToken="b77a5c561934e089" /><bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" /></dependentAssembly><dependentAssembly><assemblyIdentity name="Microsoft.Owin" culture="neutral" publicKeyToken="31bf3856ad364e35" /><bindingRedirect oldVersion="0.0.0.0-3.0.1.0" newVersion="3.0.1.0" /></dependentAssembly><dependentAssembly><assemblyIdentity name="Microsoft.Owin.Security.OAuth" culture="neutral" publicKeyToken="31bf3856ad364e35" /><bindingRedirect oldVersion="0.0.0.0-3.0.1.0" newVersion="3.0.1.0" /></dependentAssembly><dependentAssembly><assemblyIdentity name="Microsoft.Owin.Security.Cookies" culture="neutral" publicKeyToken="31bf3856ad364e35" /><bindingRedirect oldVersion="0.0.0.0-3.0.1.0" newVersion="3.0.1.0" /></dependentAssembly><dependentAssembly><assemblyIdentity name="Microsoft.Owin.Security" culture="neutral" publicKeyToken="31bf3856ad364e35" /><bindingRedirect oldVersion="0.0.0.0-3.0.1.0" newVersion="3.0.1.0" /></dependentAssembly></assemblyBinding></runtime><system.codedom><compilers><compiler language="c#;cs;csharp" extension=".cs" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:6 /nowarn:1659;1699;1701" /><compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.VBCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:14 /nowarn:41008 /define:_MYTYPE=\"Web\" /optionInfer+" /></compilers></system.codedom><!--wcf配置--><system.serviceModel><!--添加此節點,否則出現405錯誤--><bindings><wsHttpBinding><binding name="NoneSecurity"maxBufferPoolSize="12000000" maxReceivedMessageSize="12000000" useDefaultWebProxy="false"><readerQuotas maxStringContentLength="12000000" maxArrayLength="12000000"/><security mode="None"/></binding></wsHttpBinding></bindings><behaviors><serviceBehaviors><behavior name="metadataBehavior"><!-- 為避免泄漏元數據信息,請在部署前將以下值設置為 false --><serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/><!-- 要接收故障異常詳細信息以進行調試,請將以下值設置為 true。在部署前設置為 false 以避免泄漏異常信息 --><serviceDebug includeExceptionDetailInFaults="false"/></behavior><behavior name="routingBehavior"><routing filterTableName="greetingFilterTable"/></behavior></serviceBehaviors><endpointBehaviors><behavior><clientVia viaUri="http://localhost:65515/WcfService/GrettingService.svc"/></behavior></endpointBehaviors></behaviors><!--<protocolMapping><add binding="wsHttpBinding" scheme="http" /></protocolMapping>--><services><!--<service behaviorConfiguration="metadataBehavior" name="TestWcf.Service2"><endpoint address="" binding="wsHttpBinding" bindingConfiguration="NoneSecurity"contract="TestWcf.IService" /><endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" /></service>--></services><client><endpoint name="helloService" address="http://localhost:65515/WcfService/HelloService.svc" binding="ws2007HttpBinding" contract="Artech.RoutingServiceDemo.Service.Interface.IHello"/><endpoint name="goodbyeService" address="http://localhost:65515/WcfService/GoodbyeService.svc" binding="ws2007HttpBinding" contract="Artech.RoutingServiceDemo.Service.Interface.IGoodbye"/></client><!--無svc文件wcf服務激活--><serviceHostingEnvironment><serviceActivations><!--<add relativeAddress="Service2.svc" service="TestWcf.Service2"/>--></serviceActivations></serviceHostingEnvironment></system.serviceModel> </configuration>
?
轉載于:https://www.cnblogs.com/kexb/p/9436890.html
總結
- 上一篇: Web组件 – 构建商业化应用的基石
- 下一篇: 线段树模板hdu 1754:I Hate