SharpeRAD / Cake.IIS

IIS addin for Cake
http://cakebuild.net
MIT License
52 stars 28 forks source link

Call to alias "AddSiteApplication" completes but no application visible in IIS. #52

Closed sunilshahi closed 6 years ago

sunilshahi commented 6 years ago

This is my task.

image

When I run .\build.ps1 --target=create-application

I see no error.

image

When I look in IIS there is no application created there. Refresh did not help.

image

If I re-run I get error saying application already exists.

image

Running appcmd list reveals that its indeed there. image

What am I missing? I can run appcmd and create the application. appcmd add app /site.name:"Default Web Site" /path:/myapp /physicalPath:"C:\inetpub\myapp"

image

image

However "AddSiteApplication" alias is not working for me. Am I missing anything?

SharpeRAD commented 6 years ago

Sorry but it looks like your issue is that the IIS-Manager UI did not refresh, rather than the application wasn't created by Cake.IIS which is out of scope for this project.

sunilshahi commented 6 years ago

The issue is not about IIS UI not being refreshed. I don't see the application even when I refresh iis my self. I can run the appcmd like above and after refreshing I see the application. However running the task does not produce the same result. Shouldn't these two be equivalent?

Azkel commented 6 years ago

@SharpeRAD , I have the same issue.

Task("Create-
.Description("Adds Test Application to Test Website")
.Does(() => 
{
    AddSiteApplication(new ApplicationSettings()
    {
        SiteName = "Test",
        ApplicationPool = "Test",
        ApplicationPath = "/Test2",
    VirtualDirectory = "/Test2",
        PhysicalDirectory  = @"C:\Temp"
    });
});

End-result of running Cake: image

While on the left-side context menu Application is not visible, if I click "View Applications" on Right-side menu after selecting "Test" Site, I see it on the list, but without Physical Path filled. After filling Physical path with i.e. C:\Temp everything works as intended, and I can see this Application as a child of "Test" site. C:\Temp is a proper, existing path in my system. I'm using IIS 10.0.17134.1.

I'll look into it, and if I find any fix I'll propose PR with fix.

Azkel commented 6 years ago

Found a solution:

After changing from VirtualDirectory = "/Test2", to VirtualDirectory = "/", proper Physical Path in IIS has been saved.

I have created a Pull Request #55 - as this is the only place where VirtualDirectory is used for ApplicationSettings, I have removed this parameter from the code.