0
は、既存のMVC WebアプリケーションへのWCFサービスを追加します。いくつかのフォルダの下で
ex:/Service/Service1.svc
IISにMVCサイトをホストし、完全に機能テストしているサイト。
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" />
私は上のサービスは、それが見つからないエラー404
感謝を示してIIS閲覧!