微软Azure和Glassfish [英] Microsoft Azure and Glassfish

查看:107
本文介绍了微软Azure和Glassfish的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到Azure数据库和glassfish的问题。 2分钟后,Azure数据库正在关闭与glassfish池的连接。我在这里找到了


  1. 创建一个名为Startup.cmd的文件并填写PowerShell代码。


  2. 将启动任务代码配置到您的CloudService项目中的ServiceDefinition.csdef。


您将在新项目中找到ServiceDefinition.csdef。



在文件中,您可以配置启动任务。



关于启动任务的详细信息,请参考 https://msdn.microsoft.com/en-us/library/hh180155.aspx



启动任务是Azure上的Cloud Service概念。云服务有两个角色概念:Web角色,工作者角色。启动任务在角色启动运行之前执行一些必要的事情,例如配置运行时环境,修改注册表项。



关于Azure Cloud Service,请参阅 https://msdn.microsoft.com/zh-cn/library/hh124108.aspx



对于Java Developer,请参阅 https://msdn.microsoft.com/en-us/library/hh690943.aspx



如果您使用Azure虚拟机,我建议您可以手动修改注册表项。我建议你可以参考这篇文章:

https:// stackoverflow。 com / a / 32044279/4836342


I am having a problem with Azure database and glassfish. Azure database is closing the connection with glassfish pool after 2 minutes. I found the solution here but I am having a hard time implementing it.

where do I put this code ?

<Startup>
   <Task commandLine="Startup.cmd" executionContext="elevated" taskType="simple">
    </Task>
</Startup>

Where do I put the file with this code ?

if exist startup.txt goto skip
time /t >> startup.txt
REM Workaround for JDBC to SQL Azure
REG ADD HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters /v KeepAliveTime /t REG_DWORD /d 30000 >> startup.txt
REG ADD HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters /v KeepAliveInterval /t REG_DWORD /d 1000 >> startup.txt
REG ADD HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters /v TcpMaxDataRetransmission /t REG_DWORD /d 10 >> startup.txt
shutdown /r /t 1
:skip

解决方案

If you deploy Azure Cloud Service on Azure, you can use startup task to execute the cmd file and configure setting in .csdfg file. You can follow those steps:

  1. If you use Eclipse IDE to develop Java program, you can install the plugin "Azure Toolkit for Eclipse" from Eclipse Marketplace.

About Azure Toolkit for Eclipse, refer to the link https://msdn.microsoft.com/en-us/library/hh694271.aspx.

After installed the plugin on Eclipse IDE, you can create a Azure Deployment Project, as to seen from the screensnap below.

  1. Create a file named "Startup.cmd" and fill this PowerShell code into it.

  2. Configure the startup task code into "ServiceDefinition.csdef" in your CloudService Project.

You will find the "ServiceDefinition.csdef" in the new project.

In the file, you can configure the startup task.

About the Startup Task details, refer to https://msdn.microsoft.com/en-us/library/hh180155.aspx.

The startup task is a concept of Cloud Service on Azure. Cloud Service has two role concepts: Web Role, Worker Role. Startup task do some necessary things before roles start up runing, such as configure runtime environment, modify the registry keys.

About Azure Cloud Service, refer to https://msdn.microsoft.com/en-us/library/hh124108.aspx.

For Java Developer, refer to https://msdn.microsoft.com/en-us/library/hh690943.aspx

If you use Azure VM, I suggest you can modify the registry keys manually. I recommend you can refer to this post:

https://stackoverflow.com/a/32044279/4836342

这篇关于微软Azure和Glassfish的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆