0
私はKenticoを初めて使用しました。私はpowershellを使用してスクリプトを書くタスクを与えられました。私はちょっとしたトラブルを始めています。私は"PowerShell Calling Reflected Kentico API"に従ってそれを動作させようとしています。powershellでKenticoを使用しようとしています
# Configure path to the root of your web project
$webRoot = "C:\inetpub\...\CMS\"
$bin = $webRoot + "bin\"
# Load settings from web.config
[System.AppDomain]::CurrentDomain.SetData("APP_CONFIG_FILE", $webRoot + "web.config")
Add-Type -AssemblyName System.Configuration
[Configuration.ConfigurationManager].GetField("s_initState", "NonPublic, Static").SetValue($null, 0)
[Configuration.ConfigurationManager].GetField("s_configSystem", "NonPublic, Static").SetValue($null, $null)
([Configuration.ConfigurationManager].Assembly.GetTypes() | where {$_.FullName -eq "System.Configuration.ClientConfigPaths"}) [0].GetField("s_current", "NonPublic, Static").SetValue($null, $null)
# Add DLL resolution path
[System.AppDomain]::CurrentDomain.AppendPrivatePath($bin);
# Load CMSDependencies
Get-ChildItem -recurse "$webRoot\CMSDependencies\"|Where-Object {($_.Extension -EQ ".dll")} | ForEach-Object { $AssemblyName=$_.FullName; Try {Add-Type -Path $AssemblyName} Catch{ "Failed to load assembly: " + $AssemblyName + " " + $_.Exception.LoaderExceptions}}
# Load all assemblies from \bin\ (to be sure that all handlers get attached etc.)
Get-ChildItem -recurse "$bin"|Where-Object {($_.Extension -EQ ".dll")} | ForEach-Object { $AssemblyName=$_.FullName; Try {Add-Type -Path $AssemblyName} Catch{ "Failed to load assembly: " + $AssemblyName + " " + $_.Exception.LoaderExceptions}}
# Optionally, replace the above with loading only the minimum set of assemblies
#$references = @(("CMS.Base.dll"),("CMS.DataEngine.dll"), ("CMS.DataProviderSQL.dll"),("CMS.Membership.dll")) | Foreach-Object{ $bin + $_ }
#Add-Type -Path $references
# If the API you are going to use is about to touch the file system set the web application root path
#[CMS.Base.SystemContext]::WebApplicationPhysicalPath = $webRoot
# Initialize application
"Application initialized:" + [CMS.DataEngine.CMSApplication]::Init();
をしかし、私は[CMS.DataEngine.CMSApplication] ::のInit()でエラーを取得しています:特に、私が試したログインで問題になる可能性がありますどのような
Exception calling "Init" with "0" argument(s): "Login failed for user ..."
?