Microsoft Hyper-V Server с гостем Linux (Ubuntu 10.04)

Вы, вероятно, захотите настроить веб-сайт также вместо того, чтобы уехать при его настройках по умолчанию. После много царапания вокруг, это - то, что я придумал:

Sub CreateWebsite(name, hostName, physicalPath)
    ' Make connections to WMI, to the IIS namespace on the local machine. Then grab a reference to the WWW service 
    Dim locatorObj : set locatorObj = CreateObject("Wbemscripting.SWbemLocator") 
    Dim providerObj : set providerObj = locatorObj.ConnectServer(".", "root/MicrosoftIISv2") 
    Dim serviceObj : set serviceObj = providerObj.Get("IIsWebService='W3SVC'") 

    'Create a new instance as per splattne's answer
    Dim Bindings : Bindings = Array(0) 
    Set Bindings(0) = providerObj.get("ServerBinding").SpawnInstance_() 
    Bindings(0).IP = "" 
    Bindings(0).Port = "80" 
    Bindings(0).Hostname = hostName

    ' Create the new Web site using the CreateNewSite method of the IIsWebService object. 
    Dim newSitePath : newSitePath = serviceObj.CreateNewSite(name, Bindings, physicalPath) 

    ' CreateNewSite returns a string reference to the created web service. To alter the settings we need to create a string which references the root virtual directory settings.
    Dim settingsPath : settingsPath = Replace(Left(newSitePath, Len(newSitePath) - 1) & "/ROOT'", "IIsWebServer","IIsWebVirtualDirSetting")

    ' Grab a reference to the settings
    Dim settings : set settings = providerObj.get(settingsPath)

    ' By comparing the settings of an existing, manually set up site, and one created with Splattne's method I realised I needed to change the following
    settings.AspEnableParentPaths = True
    settings.AccessFlags = 512
    settings.AccessRead = True
    settings.AuthAnonymous = True
    settings.AuthFlags = 5
    settings.AuthNTLM = True
    settings.AccessScript = True
    settings.AppFriendlyName = name
    settings.Put_()

    ' Set a custom handler for 500 errors. In this case a url called 500.asp. This is a bit hacky but it works.
    settings.HttpErrors(41).Properties_("HttpErrorCode") = 500
    settings.HttpErrors(41).Properties_("HttpErrorSubcode") = "*"
    settings.HttpErrors(41).Properties_("HandlerType") = "URL"
    settings.HttpErrors(41).Properties_("HandlerLocation") = "/500.asp"
    settings.Put_()

    ' Start the service
    Dim newSite: set newSite = providerObj.Get(newSitePath)
    newSite.Start
End Sub
1
задан 14 December 2010 в 02:19
2 ответа

К дополнению к комментарию Scott решение состоит в том, чтобы включить модули, описанные в этой статье: http://blogs.technet.com/b/enterprise_admin/archive/2010/03/09/linux-and-hyper-v-the-easy-way-brown-and-serve.aspx

После того, как я пробежал шаги все работавшее отлично в Ubuntu.

В случае, если те статьи удалены кем-то или переехали сюда, шаги:

Открытый/etc/initramfs-tools/modules с Вашим любимым редактором, добавьте следующие строки:
hv_vmbus
hv_storvsc
hv_blkvsc
hv_netvsc

Выполните следующее как корень:

update-initramfs –u

И перезагрузка.

1
ответ дан 3 December 2019 в 22:19

Вы установили Компонент Интеграции Linux? SMB должен работать даже без них, но если Вы сталкиваетесь с проблемами как Вы описанный, это вероятно от не наличия просвещенной установки Linux.

1
ответ дан 3 December 2019 в 22:19

Теги

Похожие вопросы