Powershell New-WebApplication - iis-7

[Void][Reflection.Assembly]::LoadWithPartialName("Microsoft.Web.Administration")
New-WebApplication -Name 'testApp' -Site 'Default Web Site' -PhysicalPath c:\test -ApplicationPool DefaultAppPool
That is the contents of test.ps1.
When I run .\test.ps1 I get the following error.
New-WebApplication : Cannot retrieve the dynamic parameters for the
cmdlet. Retrieving the COM class factory for compon ent with CLSID
{688EEEE5-6A7E-422F-B2E1-6AF00DC944A6} failed due to the following
error: 80040154. At C:\code\work\users\mchevett\test.ps1:6 char:19
+ New-WebApplication <<<< -Name 'testApp' -Site 'Default Web Site'
-PhysicalPath c:\test -ApplicationPool DefaultAppPo ol
+ CategoryInfo : InvalidArgument: (:)
[New-WebApplication], ParameterBindingException
+ FullyQualifiedErrorId :
GetDynamicParametersException,Microsoft.IIs.PowerShell.Provider.NewWebApplicationCommand
This error message is not helping me at all. Any ideas how to get a better error message? Thanks for reading!

I had the exact same problem because I was calling the wrong version of PowerShell from my program. I'm not sure about this but I think when you have a x86 program it calls the x86 version of PowerShell, which fails.
To specifically use the 32-bit version, call this one from your program:
C:\Windows\SysWoW64\WindowsPowerShell\v1.0\powershell.exe
To use the 64-bit version (on a 64-bit OS), call this one from your program:
C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe
Using C:\Windows\SysNative\WindowsPowerShell\v1.0\powershell.exe from within a 32bit process will give you the 64bit powershell. Using it from within a 64bit process will give you a file-not-found error.

Changing Platform target to "x64" in project solution build properties worked for me:

Related

Error when deploying .NET Core webapp to Azure

I am a complete beginner on the .NET world trying to get my first dummy .NET Core webapp to run on Azure App Service.
The code can be found here:
https://github.com/jordi-chacon/bcn_pollution
My development machine runs Ubuntu, so I am using Visual Studio Code.
I currently have my .NET Core webapp running on localhost:5000 just fine and now I want it to run on Azure App Service.
I have successfully configured Continuous Deployment on my App Service to fetch the code from Github.
Then Azure tried to deploy my webapp but it failed with the following error:
Using the following command to generate deployment script: 'azure site deploymentscript -y --no-dot-deployment -r "D:\home\site\repository" -o "D:\home\site\deployments\tools" --aspNet5 "D:\home\site\repository\project.json" --aspNet5Version "1.0.0-rc1-final" --aspNet5Runtime "CLR" --aspNet5Architecture "x86"'.
Project file path: .\project.json
Generating deployment script for ASP.NET 5 Application
Generated deployment script files
Command: "D:\home\site\deployments\tools\deploy.cmd"
Handling ASP.NET 5 Web Application deployment.
Downloading dnx-clr-win-x86.1.0.0-rc1-final from https://www.nuget.org/api/v2
Unable to download package: An exception occurred during a WebClient request.
At C:\Program Files
(x86)\SiteExtensions\Kudu\50.41223.1987\bin\scripts\dnvm.ps1:694 char:13
+ throw "Unable to download package: {0}" -f
$Global:downloadData.Erro ...
+
Failed exitCode=1, command=PowerShell -NoProfile -NoLogo -ExecutionPolicy unrestricted -Command "[System.Threading.Thread]::CurrentThread.CurrentCulture = ''; [System.Threading.Thread]::CurrentThread.CurrentUICulture = '';$CmdPathFile='"D:\local\UserProfile\.dnx\temp-set-envvars.cmd"';& 'C:\Program Files (x86)\SiteExtensions\Kudu\50.41223.1987\bin\scripts\dnvm.ps1' " install 1.0.0-rc1-final -arch x86 -r CLR
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : OperationStopped: (Unable to downl...Client requ
An error has occurred during web site deployment.
est.:String) [], RuntimeException
+ FullyQualifiedErrorId : Unable to download package: An exception occurred during a WebClient request.
Anyone knows what I am doing wrong?
Thanks!
I guess you are hitting not enough disk space issue.
https://github.com/projectkudu/kudu/issues/1682
I tried your code, and repro the deployment failure.
when navigate to https://{site name}.scm.azurewebsites.net, i see below message
Parser Error Message: There is not enough space on the disk.
by default free site has 1 GB of disk space, but seems like it is an known issue that asp.net 5 application kind of require a lots of dependency and easily go over the limit. And they (Asp.net 5 folks) are working on addressing the issue.
walk-around is to deploy to a Basic or Standard site

'C:\Users\Black' is not recognized as an internal or external command, operable program or batch file

I have just installed ASP.NET 5 RC-1 Version on Windows 7 Ultimate.
I have project name MvcMovie
and then I ran the comand below
D:\Projects\MvcMovie\src\MvcMovie>dnvm list
This is the result
Active Version Runtime Architecture OperatingSystem Alias
------ ------- ------- ------------ --------------- -----
1.0.0-rc1-update1 clr x86 win
'C:\Users\Black' is not recognized as an internal or external command,
operable program or batch file.
The system cannot find the path specified.
I dont understand why I get the above error.
Then I want to run dnvm use... as below
D:\Projects\MvcMovie\src\MvcMovie>dnvm use 1.0.0-rc1-update1
But then I got this error
Adding C:\Users\Black Fujitsu\.dnx\runtimes\dnx-clr-win-x86.1.0.0-rc1-update1\bi
n to process PATH
'C:\Users\Black' is not recognized as an internal or external command,
operable program or batch file.
The system cannot find the path specified.
D:\Projects\MvcMovie\src\MvcMovie>
The issue is that your user name has a space in it as does mine. This is confirmed here:
https://github.com/aspnet/Home/issues/371
I am running VS 2015 Enterprise Update 1 with ASP.NET 5 RC 1 on Windows 10 Pro Build 1151. I have a user name with a space in it. I am getting the following error when attempting to run dnvm from the command line:
Get-Help : Get-Help could not find dnvm - Copy.cmd in a help file in this session. To download updated help topics type
: "Update-Help". To get help online, search for the help topic in the TechNet library at http://go.microsoft.com/fwlink
/?LinkID=107116.
At C:\Users\Wayne Blackmon.dnx\bin\dnvm.ps1:998 char:26
$h = Get-Help $_.Name -ShowWindow:$false
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
CategoryInfo : ResourceUnavailable: (:) [Get-Help], HelpNotFoundException
FullyQualifiedErrorId : HelpNotFound,Microsoft.PowerShell.Commands.GetHelpCommand
Copy.cmd ForEach-Object : You cannot call a method on a null-valued expression. At C:\Users\Wayne Blackmon.dnx\bin\dnvm.ps1:994 char:13
ForEach-Object {
~~~~~~~~~~~~~~~~
CategoryInfo : InvalidOperation: (:) [ForEach-Object], RuntimeException
FullyQualifiedErrorId : InvokeMethodOnNull,Microsoft.PowerShell.Commands.ForEachObjectCommand
The system cannot find the path specified.
'C:\Users\User' is not recognized as an internal or external command,
operable program or batch file.
The system cannot find the path specified.
C:\Users\User Name>
And I get the following error when I attempt to run 'dnx run' from the command line
'dnx' is not recognized as an internal or external command,
operable program or batch file.
I just ran dnvm install latest in PowerShell with no error. Then I ran dnvm list also without errors. However, I do get path errors when I run the same commands from a windows command prompt. I have confirmed that this does work when run in PowerShell. The solution is to use PowerShell when accessing dnvm and dnx from a command line. I have also confirmed that dnx run does work in Powershell. For now, use PowerShell if your windows user name has a space in it when accessing dnvm until this issue is fixed.

Can't get AWS Elastic Beanstalk Command Line Tool to work on Windows 8. Get the following PowerShell error?

Add-Type : Cannot add type due to the following exception: Compiler executable
file csc.exe cannot be found.. Verify that version 3.5 of the Microsoft .NET
Framework is installed. On 64-bit versions of Windows, the WOW64 component is
also required.
At C:\Users\Albert\Documents\WindowsPowerShell\Modules\AWSDevTools\AWSDevTools.
ps1:315 char:1
+ Add-Type -Language CSharpVersion3 -TypeDefinition $awsSource
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Add-Type], InvalidOperationEx
ception
+ FullyQualifiedErrorId : System.InvalidOperationException,Microsoft.Power
Shell.Commands.AddTypeCommand
PATH set to %SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;C:\wamp\bin\php\php5.4.3;C:\Program Files\Java\jre7\bin;C:\Program Files (x86)\Git\bin;C:\Program Files (x86)\Git\cmd;C:\Program Files\AWS-ElasticBeanstalk-CLI-2.4.0\eb\windows;C:\Windows\Microsoft.NET\Framework64\v4.0.30319;C:\Windows\Microsoft.NET\Framework\v4.0.30319
I'm following this tutorial online
Thanks
You need to install .NET 3.5 on your Windows 8 machine as it isn't installed by default. Open up the Control Panel, select Programs then Program and Features. Select the "Turn Windows Features on or off" link on the left and select .NET Framework 3.5 and press OK.

NuGet execution policy errors when installing MvcScaffolding package

I'm using Visual Web Developer Express 2010, Windows XP, and using ASP.NET MVC4 RC in a project. I have NuGet v2.0.30619.9119 installed.
I'm now trying to install the MvcScaffolding package via NuGet Package Manager Console. I get the following errors:
PM> Install-Package MvcScaffolding
Attempting to resolve dependency 'T4Scaffolding'.
Attempting to resolve dependency 'EntityFramework (≥ 4.1.10311.0)'.
You are downloading EntityFramework from Microsoft, the license agreement to which is available at http://go.microsoft.com/fwlink/?LinkId=224682. Check the package for additional dependencies, which may come with their own license agreement(s). Your use of the package and dependencies constitutes your acceptance of their license agreements. If you do not accept the license agreement(s), then delete the relevant components from your device.
Successfully installed 'EntityFramework 4.1.10715.0'.
Successfully installed 'T4Scaffolding 1.0.6'.
File Y:\asp\packages\T4Scaffolding.1.0.6\tools\init.ps1 cannot be loaded. The file Y:\asp\packages\T4Scaffolding.1.0.6\tools\init.ps
1 is not digitally signed. The script will not execute on the system. Please see "get-help about_signing" for more details..
At line:1 char:2
+ & <<<< 'Y:\asp\packages\T4Scaffolding.1.0.6\tools\init.ps1' $__rootPath $__toolsPath $__package $__project
+ CategoryInfo : NotSpecified: (:) [], PSSecurityException
+ FullyQualifiedErrorId : RuntimeException
Successfully installed 'MvcScaffolding 1.0.7'.
File Y:\asp\packages\MvcScaffolding.1.0.7\tools\init.ps1 cannot be loaded. The file Y:\asp\packages\MvcScaffolding.1.0.7\tools\init.
ps1 is not digitally signed. The script will not execute on the system. Please see "get-help about_signing" for more details..
At line:1 char:2
+ & <<<< 'Y:\asp\packages\MvcScaffolding.1.0.7\tools\init.ps1' $__rootPath $__toolsPath $__package $__project
+ CategoryInfo : NotSpecified: (:) [], PSSecurityException
+ FullyQualifiedErrorId : RuntimeException
Successfully added 'EntityFramework 4.1.10715.0' to MyProject.Web.
Successfully added 'T4Scaffolding 1.0.6' to MyProject.Web.
File Y:\asp\packages\T4Scaffolding.1.0.6\tools\install.ps1 cannot be loaded. The file Y:\asp\packages\T4Scaffolding.1.0.6\tools\inst
all.ps1 is not digitally signed. The script will not execute on the system. Please see "get-help about_signing" for more details..
At line:1 char:2
+ & <<<< 'Y:\asp\packages\T4Scaffolding.1.0.6\tools\install.ps1' $__rootPath $__toolsPath $__package $__project
+ CategoryInfo : NotSpecified: (:) [], PSSecurityException
+ FullyQualifiedErrorId : RuntimeException
'InstallationDummyFile.txt' already exists. Skipping...
Successfully added 'MvcScaffolding 1.0.7' to MyProject.Web.
File Y:\asp\packages\MvcScaffolding.1.0.7\tools\install.ps1 cannot be loaded. The file Y:\asp\packages\MvcScaffolding.1.0.7\tools\in
stall.ps1 is not digitally signed. The script will not execute on the system. Please see "get-help about_signing" for more details..
At line:1 char:2
+ & <<<< 'Y:\asp\packages\MvcScaffolding.1.0.7\tools\install.ps1' $__rootPath $__toolsPath $__package $__project
+ CategoryInfo : NotSpecified: (:) [], PSSecurityException
+ FullyQualifiedErrorId : RuntimeException
Because the init scripts aren't being executed after the install, the MvcScaffolding package is not installed correctly and the scaffold command is not recognised.
I don't know what to do about these code signing issues. Here are the current security settings:
PM> Get-ExecutionPolicy -List
Scope ExecutionPolicy
----- ---------------
MachinePolicy Undefined
UserPolicy Undefined
Process RemoteSigned
CurrentUser Undefined
LocalMachine Unrestricted
Can I change the Process scope to be Unrestricted? If so, how? Running Set-ExecutionPolicy in the NuGet console does not work:
PM> Set-ExecutionPolicy Unrestricted
Execution Policy Change
The execution policy helps protect you from scripts that you do not trust. Changing the execution policy might expose you to the security risks described in the about_Execution_Policies help topic. Do you want to change the execution policy?
[Y] Yes [N] No [S] Suspend [?] Help (default is "Y"):Y
Set-ExecutionPolicy : Windows PowerShell updated your execution policy successfully, but the setting is overridden by a policy defined at a more specific scope. Due to the override, your shell will
retain its current effective execution policy of "RemoteSigned". Type "Get-ExecutionPolicy -List" to view your execution policy settings. For more information, please see "Get-Help Set-ExecutionPol
icy."
At line:1 char:20
+ Set-ExecutionPolicy <<<< Unrestricted
+ CategoryInfo : PermissionDenied: (:) [Set-ExecutionPolicy], SecurityException
+ FullyQualifiedErrorId : ExecutionPolicyOverride,Microsoft.PowerShell.Commands.SetExecutionPolicyCommand
I've also tried doing all of this as an Administrator and that didn't help either.
Any advice or ideas would be much appreciated.
UPDATE
I can set the process execution policy in NuGet like this:
Set-ExecutionPolicy Unrestricted -Scope Process
But when I restart Visual Web Developer, the setting is forgotten and I still get an error as it keeps trying to execute the init.psl files
How can I change the execution policy permanently?
OK, I have MvcScaffolding installed correctly now.
I had to first bypass all security in NuGet:
Set-ExecutionPolicy Bypass -Scope Process
But when I restart Visual Web Developer I still get those same PowerShell errors todo with the NuGet running init.pls on startup.
I've worked out that it's because I was storing my project on a network drive. Apparently PowerShell won't execute scripts from the network drive by default.
I tried using CasPol to change the security settings, but couldn't get it to work. I gave up when I saw other people couldn't get VS to work with mapped drives as well:
CAS not working for VS2010 mapped drive
Anyway, I just have my project local now, and MvcScaffolding is installed and working.
You can set the policy for user scope and using a more secure policy like this:
Set-ExecutionPolicy -ExecutionPolicy AllSigned -Scope CurrentUser
Requires that all scripts and configuration files be signed by a trusted publisher, including scripts that you write on the local computer.
Prompts you before running scripts from publishers that you have not yet classified as trusted or untrusted.
For exemple, installing a EntityFramework ask permission to run the script:
Executing script file 'c:\users\user\documents\visual studio 2015\Projects\zzz\packages\EntityFramework.6.1.3\tools\install.ps1'
Do you want to run software from this untrusted publisher?
File C:\users\user\documents\visual studio 2015\Projects\zzz\packages\EntityFramework.6.1.3\tools\install.ps1 is published by CN=Microsoft Corporation, OU=MOPR, O=Microsoft Corporation, L=Redmond, S=Washington, C=US and is not trusted on your system. Only run scripts from trusted publishers.
[V] Never run [D] Do not run [R] Run once [A] Always run [?] Help (default is "D"):R

Can't co-create object

i made a dll in .net and call that from java program using jacob.since yesterday i have windows 7 32 bit os so program run successfully.now i formated and install windows 7 64 bit os.so following error encounter:
com.jacob.com.ComFailException: Can't co-create object
at com.jacob.com.Dispatch.createInstance(Native Method)
at com.jacob.com.Dispatch.<init>(Dispatch.java)
at com.jacob.activeX.ActiveXComponent.<init>(ActiveXComponent.java)
at product.Control_product.main(Control_product.java:21)
Register all the dll files but the error is occured.
Use a 32bit JVM to execute your code.
The DLL of the COM object you are trying to use needs to be registered. The jacob dll's do not provided they are available in the library path.
Error is solved.put the same jacob.dll and jacob.jar in the server \lib folder,jdk bin and lib folder
see here http://netheadaches.wordpress.com/2012/04/22/jacob-cant-co-create-object/
You need to register your dll file using the 64bit version of regasm.exe

Resources