0
votes

I have a WCF Service Library which is run as a windows service. I would like to migrate this service as Azure worker role. When I right click on a WCF project, I typically see the option "Add Windows Azure Deployment Project". With my WCF library, I do not see this option. In that case, how do I migrate the WCF service library to Azure as worker role? Any help would be greatly appreciated.

Below is the app.config for my WCF service library.

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

2 Answers

1
votes

In this case, I would like to suggest you to manually create a worker role project, add a reference to the service library project, and then host the service inside the worker role. The service host code is similar to what you get for a normal console/Windows Service host. But please obtain the address via code. In addition, you can refer to http://msdn.microsoft.com/en-us/WAZPlatformTrainingCourse_WindowsAzureRoleCommunicationVS2010Lab for a complete tutorial.

Best Regards,

Ming Xu.

0
votes

The Add Windows Azure Deployment Project option only appears if the project type is a WebApplication or WCF Application. You have to host your WCF library in a WebApplication and then the option will appear (or even better host it directly in a Windows Azure WebRole project).

If you really want to host your WCF library in a WorkerRole I suggest you do what Ming Xu has explained. But normally you host your WCF services in WebRoles on Windows Azure. So I hope you have a special need that explains why you want to use WorkerRoles.

I hope that helps.