【发布时间】:2016-05-16 12:34:10
【问题描述】:
我必须做和已经做的事情:
将 WCF 服务添加到现有的 mvc Web 应用程序。在某个文件夹下
ex:/Service/Service1.svc-
将 MVC 站点托管到 IIS,经过完整运行的站点测试。
namespace WebApplication3.Service { public class Service1 : IService1 { public string DoWork() { return "some string"; } } } namespace WebApplication3.Service { [ServiceContract] public interface IService1 { [OperationContract] [WebInvoke(Method = "GET")] string DoWork(); } }
和网络配置:
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="transportsecurity">
<security mode="Transport">
<transport clientCredentialType="None"></transport>
</security>
</binding>
</basicHttpBinding>
</bindings>
<services>
<service name="WebApplication3.Service.Service1" behaviorConfiguration="mybehavior">
<endpoint address="http://localhost/testsite/Service/Service1.svc" binding="basicHttpBinding" bindingConfiguration="transportsecurity" contract="WebApplication3.Service.IService1">
</endpoint>
<endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange"/>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="mybehavior">
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true"
multipleSiteBindingsEnabled="true" />
当我在 IIS 上浏览服务时,它显示未找到错误 404。
谢谢!
【问题讨论】:
标签: c# asp.net asp.net-mvc wcf asp.net-mvc-4