有一个工作流服务库公开为WFC服务。我正在尝试通过web.config文件更改其基址。我已成功更改端点的相对地址,但我也需要更改基址。我怎么能这样做?
这是我的配置:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0" />
</system.web>
<system.serviceModel>
<services>
<service name="MyService" behaviorConfiguration="ServiceBehaviors">
<host>
<baseAddresses>
<add baseAddress="http://localhost:777/"/>
</baseAddresses>
</host>
<endpoint address=""
binding="basicHttpBinding"
contract="IMyService" />
<endpoint contract="IMetadataExchange" binding="mexHttpBinding" address="mex" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="ServiceBehaviors">
<!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
<serviceMetadata httpGetEnabled="false"/>
<!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information -->
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
</serviceBehaviors>
</behaviors>
<bindings>
<mexHttpBinding>
</mexHttpBinding>
<basicHttpBinding>
<binding>
<security mode="None"/>
</binding>
</basicHttpBinding>
</bindings>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
</configuration>
答案 0 :(得分:1)
鉴于您正在使用web.config,我假设您在IIS中正在托管此内容吗?
如果是这样,IIS负责基地址。您可以在那里创建虚拟文件夹,它们与机器名称一起构成基址。您在web.config中指定的所有内容都是最终的相对位。
答案 1 :(得分:1)
如果您在Visual Studio中托管,则可能需要编辑WCF服务项目的属性。
在解决方案资源管理器中
答案 2 :(得分:0)
有几个端点的手动配置示例here (Microsoft为WF和WCF 4.0提供样本)。检查这些: