sharperad / cake.iis Goto Github PK
View Code? Open in Web Editor NEWThis project forked from ragingkore/cake.web
IIS addin for Cake
Home Page: http://cakebuild.net
License: MIT License
This project forked from ragingkore/cake.web
IIS addin for Cake
Home Page: http://cakebuild.net
License: MIT License
Hi! Thanks for the addin.
I did notice however that, when making an application pool, the settings default values (this is just the default values in C# for those properties, really) do not correspond with what IIS considers default settings.
Specifically, these settings are different:
I believe it would be wiser to follow the defaults by IIS if possible.
Please update Cake.IIS to support Cake.Core 0.26.0.
Error: The assembly 'Cake.IIS, Version=0.3.4.0, Culture=neutral, PublicKeyToken=null'
is referencing an older version of Cake.Core (0.22.0).
This assembly need to reference at least Cake.Core version 0.26.0.
We performed an automated audit of your Cake addin and found that it does not follow all the best practices.
We encourage you to make the following modifications:
.csproj
should have a line similar to this: <PackageReference Include="Cake.Core" Version="0.28.0" PrivateAssets="All" />
Apologies if this is already being worked on, or if there are existing open issues, this issue was created based on what is currently published for this package on NuGet.org and in the project on github.
see #9
not sure what needs to change, something to do with bindings, no doubt will figure it out.
Hi,
First of all thanks for the addin ;)
We have some problems though with stopping and starting the application pool sometimes. The return value is true, there is a log message saying Waiting for IIS to activate new config
but the pool is not successfully started/stopped.
Have you experienced any of this - any ideas what may be causing such behavior?
You have a lot of methods to manipulate site and server.
Could you please add GetSite and GetServer to you addin?
The aim is to be able to read site properties. I.e. website root physical path.
There are quite some inconsistencies and also different coding guidelines used.
The code should be cleaned to make further extensions easier.
I can do a PR for that.
Thanks again for creating this Cake Addin, we really appreciate the effort that you have put in to creating it.
We, the Cake Team, recently announced a new Cake Contrib Icon, details of which can be found here:
http://cakebuild.net/blog/2017/06/new-cake-contrib-icon
Would you consider changing the nuspec file for your NuGet Package to use this new Cake Contrib Icon? If so, the recommended URL to use is:
Details of the above URL can be found in the repository here:
https://github.com/cake-contrib/graphics
Please let me know if you have any questions.
Hi,
Thank you for providing this add-in -- it's very useful for us in our automated deployments.
However, I'm looking at failed deployments since version 0.1.7, in particular we have this Cake output:
error CS0117: 'Cake.IIS.WebsiteSettings' does not contain a definition for 'HostName'
The broken code looks something like:
CreateWebsite(new WebsiteSettings() {
Name = siteDirectory,
HostName = siteHostName,
PhysicalDirectory = sitePhysicalPath,
ApplicationPool = new ApplicationPoolSettings() {
Name = siteApplicationPoolName
}
});
Would the recent bindings work be expected to completely break this?
We use teamcity for our build server and I'm taking over a project for a developer who is no longer with us. He wrote a build.cake file to push our sites to our servers along with some other things. I have no experience with this and need to update it to also start and stop a site and application when the site is pushed. In googling it I came across this repository. I have updated our build.cake file with the following.
Task("deploy_live_websites")
.IsDependentOn("use_live_config")
.Does(() =>
{
foreach (var site in websites){
foreach (var server in liveServers){
CreatePool(server, new ApplicationPoolSettings()
{
Name = site.ApplicationPoolName,
Username = devWebDeployUser,
Password = devWebDeployPassword
});
CreateWebsite(server, new WebsiteSettings()
{
Name = site.SiteName,
Binding = IISBindings.Http
.SetHostName(site.HostName)
.SetIpAddress("*")
.SetPort(80),
PhysicalDirectory = site.PhysicalDirectory,
ApplicationPool = new ApplicationPoolSettings()
{
Name = site.ApplicationPoolName
}
});
StopSite(server, site.SiteName);
StopPool(site.ApplicationPoolName);
DeployWebsite(new DeploySettings()
{
SourcePath = "./artifacts/_PublishedWebsites/" + site.Name + "/",
ComputerName = server,
SiteName = site.SiteName,
Username = webDeployUser,
Password = webDeployPassword
});
StartPool(site.ApplicationPoolName);
StartSite(site.SiteName);
}
}
});
Specifically the update I made was the StopSite, StopPool, StartPool, StarSite lines.
When I push this to our build server it fails when this executes. The error I get is
[20:29:19][Step 1/1] ========================================
[20:29:19][Step 1/1] deploy_live_websites
[20:29:19][Step 1/1] ========================================
[20:29:19][Step 1/1] Executing task: deploy_live_websites
[20:29:19][Step 1/1] Application pool 'TECWare_v4' is system's default.
[20:29:19][Step 1/1] An error occurred when executing task 'deploy_live_websites'.
[20:29:19][Step 1/1] Error: One or more errors occurred.
[20:29:19][Step 1/1] Could not load file or assembly 'System.Diagnostics.TraceSource, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
[20:29:19][Step 1/1] Process exited with code 1
[20:29:05][Step 1/1] Process exited with code 1
[20:29:19][Step 1/1] Step PowerShell failed
I have no idea what the issue is. Anyone have an idea on how to fix this? It worked fine before adding the start/stop methods. Also I added #addin "Cake.IIS" to the top of the file.
To get this addin to run correctly I had to add &loaddependencies=true
otherwise I would get an error like
Could not load file or assembly 'System.ServiceProcess.ServiceController, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' ...
maybe add this to the FAQ/Wiki
Dear Developers,
lately my Team can't use the SiteExists() funtion. The functions throws allways a NullReferenceException.
It's related to the latest addin version and occurs on Windows 10 (latest and previous update versions)
Is this a known issue or does someone have any ideas for a workaround?
With kind regards.
I'm not able to google myself out of this. Maybe you have seen this before.
my cake script is just this
#addin "Cake.IIS"
StartPool("MachineName", "PoolName");
Error: System.AggregateException: One or more errors occurred. --->
System.AggregateException: One or more errors occurred. --->
System.Runtime.InteropServices.COMException: Retrieving the COM class factory for remote component with CLSID {2B72133B-3F5B-4602-8952-803546CE3344} from machine <machineName> failed due to the following error: 800703fa <machineName>.
at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck)
at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark)
at System.Activator.CreateInstance(Type type, Boolean nonPublic)
at System.Activator.CreateInstance(Type type)
at Microsoft.Web.Administration.ConfigurationManager.CreateAdminManager[TClass,TInterface](WebConfigurationMap webConfigMap, Boolean isAdminConfig, Boolean isRedirectionConfig)
at Microsoft.Web.Administration.ConfigurationManager.CreateWritableAdminManager(WebConfigurationMap webConfigMap, String configPathToEdit, Boolean isAdminConfig, Boolean isRedirectionConfig)
at Microsoft.Web.Administration.ConfigurationManager.CreateConfiguration(WebConfigurationMap configMap, String configPathToEdit, Boolean isAdminConfig, Boolean isRedirectionConfig)
at Microsoft.Web.Administration.ConfigurationManager.GetConfiguration(String rawConfigurationPath, String cacheKey, Boolean isAdminConfig, Boolean isRedirectionConfig)
at Microsoft.Web.Administration.ConfigurationManager.GetApplicationHostConfiguration()
at Microsoft.Web.Administration.ServerManager.ApplicationPoolsSectionCreator()
at Microsoft.Web.Administration.Lazy.Initialize[T](T& target, CreateInstanceDelegate`1 valueFactory)
at Microsoft.Web.Administration.ServerManager.ApplicationPoolCollectionCreator()
at Microsoft.Web.Administration.Lazy.Initialize[T](T& target, CreateInstanceDelegate`1 valueFactory)
at Cake.IIS.ApplicationPoolManager.Start(String name)
at Cake.IIS.ApplicationPoolAliases.StartPool(ICakeContext context, String server, String name)
at Submission#0.StartPool(String server, String name)
at Submission#0.<<Initialize>>d__0.MoveNext()
I am using remote iis so I am unavailable to use versions higher than 0.3.1, because it is a mistake with remote
This is my task.
When I run .\build.ps1 --target=create-application
I see no error.
When I look in IIS there is no application created there. Refresh did not help.
If I re-run I get error saying application already exists.
Running appcmd list reveals that its indeed there.
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"
However "AddSiteApplication" alias is not working for me. Am I missing anything?
When adding a site I get:
System.IO.FileNotFoundException: Could not load file or assembly 'System.Reflection.TypeExtensions, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
Adding NuGet package Microsfoft.Win32.Registry, returns:
System.IO.FileNotFoundException: Could not load file or assembly 'System.Reflection.TypeExtensions, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
problem seems fixed when adding System.Reflection.TypeExtensions Nuget package as addin.
This seems gimmicky... Add dependencies to project or update documentation maybe?
First of all, I wanted to thank you for adding to the Cake community by adding this addin.
I was just wondering if you had seen this blog post:
http://cakebuild.net/blog/2016/08/cake-contribution-organization
We are currently going through a process of increasing the visibility of addins, and also trying to ensure their long term maintainability.
To that end, we are asking addin creators to add the cake-contrib user on NuGet as a co-owner (this can be done through the NuGet website by clicking on Manage Owners
on the package page).
Would you be interested in doing this for Cake.IIS? If you have any questions about this, please let me know. There was some initial concern that the Cake Team were trying to "take over" packages, and that couldn't be further from the truth, and if you have this concern, or others, I would like to address them.
Thanks!
Hello! So recently Cake 0.22.x was released (https://cakebuild.net/blog/2017/09/cake-v0.22.1-and-v0.22.2-released) and now it is recommended to reference the freshest version.
Thanks!
Hi
I simply cannot get the IIS binding on HTTPS to add the cert.
The cert is added as a self signed and in the web hosting store.
I can find the cert in the store but set cert store and set cert hash does not result in the cert being set :-/
Any ideas?
Code snipit:
var x509Store = new X509Store("WebHosting", StoreLocation.LocalMachine);
var bindingSettings = IISBindings.Https
.SetIpAddress("*")
.SetHostName(string.Empty)
.SetPort(443)
.SetCertificateStoreName(x509Store.Name);
x509Store.Open(OpenFlags.ReadOnly);
var certificates = x509Store.Certificates;
Console.WriteLine("Cert count "+ certificates.Count + " and looking for " + siteName);
foreach(var x509 in certificates)
{
Console.WriteLine("Cert "+ x509.FriendlyName);
if(x509.FriendlyName.Equals(siteName, StringComparison.InvariantCultureIgnoreCase))
{
Console.WriteLine("Cert " + siteName + " found with hash " + System.Text.Encoding.UTF8.GetString(x509.GetCertHash()));
bindingSettings.SetCertificateHash(x509.GetCertHash);
break;
}
}
CreateWebsite(remoteServerName, new WebsiteSettings()
{
Name = siteName,
Binding = bindingSettings,
PhysicalDirectory = outputDir,
ApplicationPool = new ApplicationPoolSettings()
{
Name = siteName
},
Overwrite = true
});
x509Store.Close();
Hi, I tried to stop website on my remote IIS like so:
StopSite(serverName,siteName);
but this resulted in:
An error occurred when executing task 'Default'.
Error: Unable to cast COM object of type 'System.__ComObject' to interface type 'Microsoft.Web.Administration.Interop.IAppHostWritableAdminManager'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{FA7660F6-7B3F-4237
-A8BF-ED0AD0DCBBD9}' failed due to the following error: Interface not registered (Exception from HRESULT: 0x80040155).
Do you have any idea what this can be caused from?
The AddBinding creates an extra ":" before the binding.
AddBinding(websiteName, new BindingSettings(){ BindingProtocol = BindingProtocol.NetTcp, Port = websiteNetTcpPort, HostName="*"
This creates :40005:* but expecting 40005:*
As the title says, I cannot add a Site if I don't specify the VirtualDirectory in ApplicationSettings. (Error: Invalid virtual directory path")
The example in the readme are rather mislieading in that case as it does not have the virtual directory set.
Hi,
could you please upgrade dependency to Cake 1.0.0?
Hello!
I have a task for deploying the site. One feature is there that the PhysicalPath
of the site changes everytime when deploying new version (For example: C:\Apps\CompProject_v_1.0.0.1, next C:\Apps\CompProject_v_1.0.0.2). I know that this is not good solution, but this is what I have . I can't find the way how to change the PhysicalPath
of the existing site. Thank you in advance!
It should be possible to enable directory browsing.
See: https://docs.microsoft.com/en-us/iis/configuration/system.webserver/directorybrowse
using(ServerManager serverManager = new ServerManager()) {
Configuration config = serverManager.GetWebConfiguration("Contoso");
ConfigurationSection directoryBrowseSection = config.GetSection("system.webServer/directoryBrowse");
directoryBrowseSection["enabled"] = true;
directoryBrowseSection["showFlags"] = @"Date, Time, Size, Extension";
serverManager.CommitChanges();
}
Cake.IIS code has bug when trying to set authentication settings. I have fixed the code and added tests but i can not push my changes, keep getting access denied. I can send you my changes if preferred. Thanks
Cake version = 0.30.0
Cake.IIS version = 0.4.1
When specifying a remote location for these functions I get a null exception.
DeletePool("127.0.0.1", "Test") - Fail
StopPool("localhost", "Test") - Fail
The functions work if you don't use the remote-location at all.
DeletePool( "Test") - Success
StopPool("Test") - Success
Error:
Error: System.AggregateException: One or more errors occurred. ---> System.NullReferenceException: Object reference not set to an instance of an object.
at Microsoft.Web.Administration.ConfigurationManager.CreateWritableAdminManager(WebConfigurationMap webConfigMap, String configPathToEdit, Boolean isAdminConfig, Boolean isRedirectionConfig)
at Microsoft.Web.Administration.ConfigurationManager.CreateConfiguration(WebConfigurationMap configMap, String configPathToEdit, Boolean isAdminConfig, Boolean isRedirectionConfig)
at Microsoft.Web.Administration.ConfigurationManager.GetConfiguration(String rawConfigurationPath, String cacheKey, Boolean isAdminConfig, Boolean isRedirectionConfig)
at Microsoft.Web.Administration.ConfigurationManager.GetApplicationHostConfiguration()
at Microsoft.Web.Administration.ServerManager.ApplicationPoolsSectionCreator()
at Microsoft.Web.Administration.Lazy.Initialize[T](T& target, CreateInstanceDelegate`1 valueFactory)
at Microsoft.Web.Administration.ServerManager.ApplicationPoolCollectionCreator()
at Microsoft.Web.Administration.Lazy.Initialize[T](T& target, CreateInstanceDelegate`1 valueFactory)
at Cake.IIS.ApplicationPoolManager.Stop(String name)
at Cake.IIS.ApplicationPoolAliases.StopPool(ICakeContext context, String server, String name)
at Submission#0.StopPool(String server, String name)
at Submission#0.<<Initialize>>b__0_1()
I had to downgrade to these versions to use the remote-location successfully
Cake version = 0.22.0
Cake.IIS version = 0.3.1
I'm hitting this exception:
Retrieving the COM class factory for remote component with CLSID {2B72133B-3F5B-4602-8952-803546CE3344} from machine failed due to the following error: 800706ba
I'm running as admin and firewall is off. But I'm trying to configure the localhost (I'm automating my development setup).
I hit problems on trying to create AppPool:
Task("Create-Application-Pool")
.Description("Create a ApplicationPool")
.Does(() =>
{
CreatePool("MyProject.dev", new ApplicationPoolSettings()
{
Name = "MyProject.dev",
IdentityType = IdentityType.LocalSystem,
});
});
where MyProject.dev
is a domain name in hosts
file pointing to 127.0.01
.
Anything I can do to debug?
We performed an automated audit of your Cake addin and found that it does not follow all the best practices.
We encourage you to make the following modifications:
.csproj
should have a line similar to this: <PackageReference Include="Cake.Core" Version="0.33.0" PrivateAssets="All" />
.csproj
should have a line like this: <PackageIconUrl>https://cdn.jsdelivr.net/gh/cake-contrib/graphics/png/cake-contrib-medium.png</PackageIconUrl>
.Apologies if this is already being worked on, or if there are existing open issues, this issue was created based on what is currently published for this package on NuGet.
This issue was created by a tool: Cake.AddinDiscoverer version 3.12.1
We've recently released new icons for Cake extensions, to help more easily differentiate Cake Addins, Modules, Recipes, etc.
More information: https://github.com/cake-contrib/graphics
Could not load file or assembly 'System.Reflection.TypeExtensions, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified
When I add the dll to tools\Addins\cake.iis\Cake.IIS\lib\net461 myself, the issue seems to be gone
Hello @SharpeRAD
Is it possible to run these Tasks on remote servers?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.