如何更改WF4.0工作流服务中的基址?

发布于 2024-11-03 03:12:43 字数 2024 浏览 3 评论 0原文

有一个工作流服务库公开为 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>

There's a Workflow Service Library exposed as WFC Service. I'm trying to change its base address via web.config file. I've succeded in changing relative address of the endpoints, but I need to change base address too. How can I do this?

Here's my 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>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

梦屿孤独相伴 2024-11-10 03:12:44

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

在“解决方案资源管理器”中

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

If your hosting in Visual Studio you may need to edit the properties of your WCF Service project.

In Solution Explorer

  • navigate to your WCF Service project
  • right-click and choose Properties
  • select the Web tab
  • in the Servers section choose Specific Port and change the Virtual Path and/or port
浅浅淡淡 2024-11-10 03:12:44

鉴于您正在使用 web.config,我假设您将其托管在 IIS 内部,如果正确的话?

如果是这样,则 IIS 负责基地址。您在那里创建虚拟文件夹,它们与计算机名称结合形成基地址。您可以在 web.config 中指定的只是最终的相关位。

Given that you are using a web.config I am assuming that you are hosting this inside if IIS right?

If so IIS is responsible for the base address. You create your virtual folders there and they, combined with the machine name, form the base address. All you can specify in the web.config is the final relative bit.

∝单色的世界 2024-11-10 03:12:44

有多个端点手动配置示例 此处
(WF 和 WCF 4.0 的 Microsoft 示例)。检查这些:

  • WF\Basic\Execution\ManagementEndpoint\
  • WF\Basic\Execution\CreationEndpoint\
  • WF\Basic\Execution\ResumeBookmarkEndpoint

There're several examples of manual configuration of the endpoints here
(Microsoft samples for WF & WCF 4.0). Check for these ones:

  • WF\Basic\Execution\ManagementEndpoint\
  • WF\Basic\Execution\CreationEndpoint\
  • WF\Basic\Execution\ResumeBookmarkEndpoint
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文