【问题标题】:How to automatically create an IIS website via script如何通过脚本自动创建 IIS 网站
【发布时间】:2016-06-06 06:45:53
【问题描述】:

我们有一个 MVC5 C# 网站,允许客户购买域名。 购买后,我们希望网站在 IIS 中自动创建,以便对其的任何调用(例如称为 www.test.com)都会显示一个新的模板网站。

最好的方法是什么?最好为 powershell 编写脚本吗?

有人知道在 Azure 中执行此操作所需的脚本吗?

【问题讨论】:

    标签: powershell azure iis dns


    【解决方案1】:

    要自动创建 Azure 网站,您可以在 C# 中使用 PowerShell 或 Azure Management Librairies

    这是使用 Powershell 创建 Azure 网站的脚本:

    $rgName = 'example-RG';
    $location = 'West Europe';
    $servicePlanName = 'example-SP';
    $siteName = 'exampleWebsite Name';
    
    Login-AzureRmAccount
    
    #Create the resource Group
    New-AzureRmResourceGroup -Name $rgName -Location $location
    
    #Create the service plan
    New-AzureRmAppServicePlan -ResourceGroupName $rgName -Location $location -  Name $servicePlanName -Tier Free
    
    #Create the web app
    New-AzureRmWebApp -ResourceGroupName $rgName -Location $location -Name $siteName -AppServicePlan $servicePlanName
    

    【讨论】:

      【解决方案2】:

      您可以使用c#PowerShell 创建站点,由您选择。

      对于 PowerShell,请使用 WebAdministration moduleNew-Websitecmdlet。对于 Azure 网站,请使用 Azure Resource Manager

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2010-10-13
        • 2010-12-23
        • 2021-08-26
        • 1970-01-01
        • 2012-07-27
        • 2011-11-30
        相关资源
        最近更新 更多