0
事情我必須做的,已經做了:主機WCF現有的MVC的Web站點
添加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(); } }
和web配置:
<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
謝謝!