如何更改WF4.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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
如果您在 Visual Studio 中托管,您可能需要编辑 WCF 服务项目的属性。
在“解决方案资源管理器”中
If your hosting in Visual Studio you may need to edit the properties of your WCF Service project.
In Solution Explorer
鉴于您正在使用 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.
有多个端点手动配置示例 此处
(WF 和 WCF 4.0 的 Microsoft 示例)。检查这些:
There're several examples of manual configuration of the endpoints here
(Microsoft samples for WF & WCF 4.0). Check for these ones: