首页 文章

将WCF迁移为Azure辅助角色

提问于
浏览
0

我有一个WCF服务库,它作为Windows服务运行 . 我想将此服务迁移为Azure辅助角色 . 当我右键单击WCF项目时,我通常会看到“添加Windows Azure部署项目”选项 . 使用我的WCF库,我没有看到此选项 . 在这种情况下,如何将WCF服务库作为辅助角色迁移到Azure?任何帮助将不胜感激 .

下面是我的WCF服务库的app.config .

<?xml version="1.0"?>
<configuration>
<system.serviceModel>
    <bindings>
        <netTcpBinding>
            <binding name="NetTcpBinding_IHealthService" closeTimeout="00:01:00"
                openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
                transactionFlow="false" transferMode="Buffered" transactionProtocol="OleTransactions"
                hostNameComparisonMode="StrongWildcard" listenBacklog="10"
                maxBufferPoolSize="524288" maxBufferSize="65536" maxConnections="10"
                maxReceivedMessageSize="65536">
                <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
                    maxBytesPerRead="4096" maxNameTableCharCount="16384" />
                <reliableSession ordered="true" inactivityTimeout="00:10:00"
                    enabled="false" />
                <security mode="None">
                    <transport clientCredentialType="Windows" protectionLevel="EncryptAndSign" />
                    <message clientCredentialType="Windows" algorithmSuite="Default" />
                </security>
            </binding>
        </netTcpBinding>
    </bindings>
    <client>
        <endpoint address="net.tcp://localhost:9017/monitor/health/service.svc"
            binding="netTcpBinding" bindingConfiguration="NetTcpBinding_IHealthService"
            contract="HealthService.IHealthService" name="NetTcpBinding_IHealthService" />
    </client>
</system.serviceModel>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup>
</configuration>

2 回答

  • 1

    在这种情况下,我建议您手动创建辅助角色项目,添加对服务库项目的引用,然后在辅助角色中托管服务 . 服务主机代码与普通控制台/ Windows服务主机的代码类似 . 但请通过代码获取地址 . 另外,您可以参考http://msdn.microsoft.com/en-us/WAZPlatformTrainingCourse_WindowsAzureRoleCommunicationVS2010Lab获取完整的教程 .

    最好的祝福,

    徐明 .

  • 0

    仅当项目类型是WebApplication或WCF应用程序时,才会显示“添加Windows Azure部署项目”选项 . 您必须在WebApplication中托管WCF库,然后将显示该选项(或者甚至更好地将其直接托管在Windows Azure WebRole项目中) .

    如果你真的想在一个WorkerRole中托管你的WCF库,我建议你做明旭所解释的 . 但通常您在Windows Azure上的WebRoles中托管您的WCF服务 . 所以我希望你有一个特殊需求,解释你为什么要使用WorkerRoles .

    我希望有所帮助 .

相关问题