以下是在 WCF 的 web.config 中配置 serviceModel 的方式:
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="basicHttpWithSecure">
<security mode="TransportCredentialOnly">
<transport clientCredentialType="Basic"></transport>
</security>
</binding>
</basicHttpBinding>
</bindings>
<services>
<service name="CMA.Customers">
<endpoint name="basic" binding="basicHttpBinding" contract="CMA.Customers" bindingConfiguration="basicHttpWithSecure"></endpoint>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior>
<!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
<serviceMetadata httpsGetEnabled="true" />
<!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information -->
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
</system.serviceModel>
该服务部署在 IIS 上,我可以使用 url 访问它 - https://www.companyname.co.uk/sitename/wcfservicename/service.svc 身份验证设置为“匿名”,IIS 中的“基本”用于这个 WCF。
现在我在同一个站点上部署了一个 MVC 应用程序,并且我想指向该 MVC 站点来使用这个 WCF。如何在我的 MVC 站点的 web.config 中配置它?
或者您认为需要对 WCF 的配置进行任何更改才能使其成为可能?