WCF服务的IIS托管(应用程序)

2021/4/25 22:25:10

本文主要是介绍WCF服务的IIS托管(应用程序),对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

基本思路

建立与发布参考网站托管

在IIS中某一网站,选择添加应用程序

 


访问服务uri:
http://localhost/wcfAppTest/Service1.svc
wcfAppTest/Service1.svc 别名+.svc
访问具体的服务
http://localhost/wcfAppTest/Service1.svc/service/GetData/23
/service/GetData/23 endpoint中的address/方法名/参数

 

比网站托管多了一个wcfAppTest

配置文件参考

  <appSettings>    <add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />  appSettings>  <system.web>    <compilation debug="true" targetFramework="4.5" />    <httpRuntime targetFramework="4.5" />  system.web>  <system.serviceModel>    <bindings>      <webHttpBinding>        <binding name="NewBinding0" />      webHttpBinding>    bindings>    <services>      <service name="WcfService4.Service1">        <endpoint address="/service" behaviorConfiguration="web" binding="webHttpBinding" bindingConfiguration="" contract="WcfService4.IService1" />      service>    services>    <behaviors>      <serviceBehaviors>        <behavior>                    <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />                    <serviceDebug includeExceptionDetailInFaults="false" />        behavior>      serviceBehaviors>      <endpointBehaviors>        <behavior name="web">          <webHttp />        behavior>      endpointBehaviors>    behaviors>    -->    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />  system.serviceModel>  <system.webServer>    <modules runAllManagedModulesForAllRequests="true" />        <directoryBrowse enabled="true" />        <handlers>            <remove name="ISAPI-dll" />            <add name="test2" path="*.svc" verb="*" modules="IsapiModule" scriptProcessor="D:\WcfService4\bin\WcfService4.dll" resourceType="File" preCondition="bitness32" />            <add name="test" path="*.dll" verb="*" modules="IsapiModule" scriptProcessor="D:\WcfService4\bin\WcfService4.dll" resourceType="File" preCondition="bitness32" />        handlers>  system.webServer>

 



这篇关于WCF服务的IIS托管(应用程序)的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!


扫一扫关注最新编程教程