我已经从这个链接从 Codeplex 下载了一个分层示例:https ://layersample.codeplex.com/releases/view/107797
这包含具有以下结构的 WCF 服务:
- 服务合同库
- 服务实现库
- 网络主机项目
问题:在虚拟主机项目中,没有.SVC
文件,它只包含web.config
文件中的配置。
谁能指导我它是如何工作的,或者我如何在客户端应用程序中使用/添加服务引用/如何在 IIS 上托管它。
这是web.config
文件:
<system.serviceModel>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true">
<serviceActivations>
<add factory="System.ServiceModel.Activation.ServiceHostFactory"
relativeAddress="./LeaveService.svc"
service="LeaveSample.Services.LeaveService" />
<add factory="System.ServiceModel.Activities.Activation.WorkflowServiceHostFactory"
relativeAddress="./LeaveWorkflowService.svc"
service="LeaveSample.Workflows.LeaveWorkflowService" />
</serviceActivations>
</serviceHostingEnvironment>
<services>
<service name="LeaveSample.Services.LeaveService"
behaviorConfiguration="DefaultServiceBehavior">
<endpoint name="basicHttpLeaveService"
address=""
binding="basicHttpBinding"
contract="LeaveSample.Services.Contracts.ILeaveService" />
<endpoint
address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
<service name="LeaveWorkflowService">
<endpoint name="basicHttpWorkflowService"
address=""
binding="basicHttpBinding"
contract="ILeaveWorkflowService" />
<endpoint
address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="DefaultServiceBehavior">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
<behavior name="">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
<sqlWorkflowInstanceStore connectionStringName="workflowStore"
hostLockRenewalPeriod="00:00:30"
runnableInstancesDetectionPeriod="00:00:05"
instanceCompletionAction="DeleteAll"
instanceLockedExceptionAction="AggressiveRetry"
instanceEncodingOption="GZip" />
<workflowUnhandledException action="Cancel"/>
<dataContractSerializer maxItemsInObjectGraph="2147483647" />
</behavior>
</serviceBehaviors>
</behaviors>
<extensions>
<behaviorExtensions></behaviorExtensions>
</extensions>
<tracking>
<profiles></profiles>
</tracking>
</system.serviceModel>
谢谢