2011-04-21 46 views
0

有一个工作流服务库作为WFC服务公开。我试图通过web.config文件更改其基址。我已经成功地更改了端点的相对地址,但我也需要更改基址。我怎样才能做到这一点?如何更改WF4.0工作流服务中的基址?

这里是我的配置:

<?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> 

回答

1

如果您在Visual Studio中托管,则可能需要编辑WCF服务项目的属性。

在解决方案资源管理器

  • 导航到你的WCF服务项目
  • 单击鼠标右键,选择属性
  • 选择在服务器部分Web选项卡
  • 选择特定的端口并更改虚拟路径和/或端口
+0

Thanx!这就是我一直在寻找的。很简单:-) – Dima 2011-04-22 05:17:00

1

假设您正在使用的web.config我假设你正在主持这里面如果IIS吧?

如果是这样IIS负责基地址。您可以在那里创建虚拟文件夹,并将它们与机器名称组成基地址。所有你可以在web.config中指定的是最后的相对位。

+0

现在我在Visual Studio中托管它。部署到生产时我将使用Windows服务。 – Dima 2011-04-21 13:24:37

0

有几个手动配置端点的示例here (WF & WCF 4.0的微软样本)。检查这些的:

  • WF \基本\执行\ ManagementEndpoint \
  • WF \基本\执行\ CreationEndpoint \
  • WF \基本\执行\ ResumeBookmarkEndpoint