之前对WWF Host概念比较模糊,仔细看了ExpenseReporting之后,比较清楚了,
在ExpenseHost.exe,有一个配置文件ExpenseHost.exe.config,其中有一段
<system.serviceModel>
<services>
<service name="ExpenseLocalServices.ExpenseService">
<!-- Use base address provided by host. -->
<!-- Specify BasicProfile binding and a binding configuration to use. -->
<endpoint
address="http://tianchi-cleo:8081/WFSamples/ExpenseService"
binding="wsHttpBinding"
contract="ExpenseContracts.IExpenseService" />
</service>
</services>
</system.serviceModel>
其中http://tianchi-cleo:8081/WFSamples/ExpenseService就是你Host的地址,我认为,ExpenseHost.exe最终在这个地址端口建立一个服务,这样,ExpenseApplication.exe和ManagerApplication.exe可以同过这个端口进行通讯。因为你在ExpenseApplication.exe.config和ManagerApplication.exe.config可以看到相似的配置片断,(你如果要修改,请一定要改成一致,否则。。。)我们之前一直迷惑怎么进行非本机的Host,现在清楚了,只要改成远程地址就可以了。<services>
<service name="ExpenseLocalServices.ExpenseService">
<!-- Use base address provided by host. -->
<!-- Specify BasicProfile binding and a binding configuration to use. -->
<endpoint
address="http://tianchi-cleo:8081/WFSamples/ExpenseService"
binding="wsHttpBinding"
contract="ExpenseContracts.IExpenseService" />
</service>
</services>
</system.serviceModel>
运行结果如下: