I want to execute this with ant (the command is working is if directly past in cmd)
%windir%\system32\inetsrv\Appcmd set site /site.name:"Default Web Site" /+bindings.[protocol='https',bindingInformation='*:443:']
But it is not working. It seems the problem is that I am not escaping something (my suspected are / + [ symbols). I have tried this but it still does not work:
C:\Windows\system32\inetsrv\Appcmd set site /site.name:"Default Web Site" /+bindings.[protocol='https',bindingInformation='*:443:']
This is a segment from my build script
<!-- Create the actual https binding for the Site -->
<staf location="local"
service="PROCESS"
request="START COMMAND netsh http add sslcert ipport=0.0.0.0:443 certstorename=MY certhash=${local.machine.certhash} appid={${local.machine.keycontainer}} WAIT STDERRTOSTDOUT RETURNSTDOUT"
throwBuildException="STAF ERROR" />
<staf location="local"
service="PROCESS"
request="START COMMAND %windir%\system32\inetsrv\Appcmd set site /site.name:"Default Web Site" /+bindings.[protocol='https',bindingInformation='*:443:'] WAIT STDERRTOSTDOUT RETURNSTDOUT"
throwBuildException="STAF ERROR" />
The error I am getting from the execution is:
RC=0, Result=
[staf] {
[staf] Return Code: 87
[staf] Key : <None>
[staf] Files : [
[staf] {
[staf] Return Code: 0
[staf] Data : Failed to process input: The parameter 'Site' must begin with a / or - (HRESULT=80070057).
The correctly escaped command was:
<staf location="local"
service="PROCESS"
request="START COMMAND "C:\\Windows\\system32\\inetsrv\\Appcmd set site /site.name:\"Default Web Site\" /+bindings.[protocol='https',bindingInformation='*:443:']" WAIT STDERRTOSTDOUT RETURNSTDOUT"
throwBuildException="STAF ERROR" />
Related
Thank for reading my post.
I'm having an issue making my Website Application(Yii2) works correctly in Azure Web Apps. I've migrated my Yii2 Websites from an existing server to the Azure Web Apps. After lots of manipulation listed below, I’m able to access the Website.
The main theme loads successfully but throwing "404 Page not found
The requested page is missing, or the address has been changed" Error in the body and others links in the "Menu Bar" not working too. "The resource you are looking for has been removed, had its name changed, or is temporarily unavailable."
The Azure Resources are configured as below:
1 x App Service Plan : S1:1 (Windows Base)
1 x Azure Database for MySQL server
1 x App Service (The Web App)
App Service Application Setting:
.Net Framwork: v4.7
PHP Version: 7.0
Platform: 32bit
Migration Steps:
FTP all files/folder from htdocs in my existing server to my App Service Plan (\site/wwwroot)
Generate the SQL Table creation in PhpAdmin
Find and Replace ENGINE=InnoDB DEFAULT CHARSET=utf8; in the script
Connect to Azure Database for MySQL server, create new Schema and Run the Script
From Azure, KUDU Inferface browse (\site\wwwroot\config) and change the db.php to
<?php
return [
'class' => 'yii\db\Connection',
'dsn' => 'mysql:host=xxxx.mysql.database.azure.com;dbname=xxxxx',
'username' => 'xxxxxxx#xxxxxxxxxxxxxxxxxx',
'password' => 'xxxxxx',
'charset' => 'utf8',
];
Restart the Web App
Check the https://yourdomain.com/requirements.php (Passed without any Error)
"The resource you are looking for has been removed, had its name changed, or is temporarily unavailable" when trying to browse the new Web App.
KUDO PowerShell windows browse back to site/wwwroot and executed the following line of codes
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php composer-setup.php
php composer.phar global require "fxp/composer-asset-plugin:^1.2.0"
Browse to the Directory (\site\wwwroot\web) and change index.php with the following line of codes:
if (!isset($_SERVER['HTTPS']) || $_SERVER['HTTPS'] !== 'on') {
if(!headers_sent()) {
header("Status: 301 Moved Permanently");
header(sprintf(
'Location: https://%s%s',
$_SERVER['HTTP_HOST'],
$_SERVER['REQUEST_URI']
));
exit();
}
}
// comment out the following two lines when deployed to production
('YII_DEBUG') or define('YII_DEBUG', false);
defined('YII_ENV') or define('YII_ENV', 'prod');
require(__DIR__ . '/../vendor/autoload.php');
require(__DIR__ . '/../vendor/yiisoft/yii2/Yii.php');
$config = require(__DIR__ . '/../config/web.php');
(new yii\web\Application($config))->run();
From the Azure Portal / Web App / Application settinh, .change the default directory from site\wwwroot to site\wwwroot\web
Restart the Web App.
The home page them now loads successfully but with a 404 Error within the body and "The resource you are looking for has been removed, had its name changed, or is temporarily unavailable." when trying to access other pages in the header.
I also noted that I have 2 .htacss file
1x in my \site\wwwroot and 1x in my \site\wwwroot\web
Haved tried deleting them and configure a web.config file in (site\wwwroot\web) but still not working.
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="Redirect rquests to default azure websites domain" stopProcessing="true">
<match url="(.*)" />
<conditions logicalGrouping="MatchAny">
<add input="{HTTP_HOST}" pattern="^yoursite\.azurewebsites\.net$" />
</conditions>
<action type="Redirect" url="https://mysitename.azurewebsites.net/{R:0}" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
As Yii2 is not famous in Azure Web App, can't find a solution anywhere. Will appreciate if you can help along.
I have this command, which works when running in command line directly.
import "os/exec"
...
out, err := exec.Command("cmd", "/C", `%windir%\system32\inetsrv\appcmd list APP /site.name:"My website" /text:[path='/'].physicalPath`).Output()
When I run it via Go app, it throws exit status 3222072890 with this error message:
Failed to process input: Invalid XML input - please make sure that your XML is well-formed and follows the required format (HRESULT=c00cee3a).
I've already tried to change slashes, use various quotation marks, but still does not work.
I use IIS 8.5 on Windows Server 2012 R2.
It seems that command is corrupted before execution. Is there any way how to see the output command?
It seems to be a bug in golang library - related to a Golang Github issue #15566.
Issue is caused by quotation marks in /site.name argument ("My website") which are escaped, but should not be.
Solution for this time is this:
import "os/exec"
import "syscall"
...
cmd := exec.Command(`cmd`)
cmd.SysProcAttr = &syscall.SysProcAttr{
CmdLine: `/C %windir%\system32\inetsrv\appcmd list APP /site.name:"My website" /text:[path='/'].physicalPath`,
}
out, err := cmd.Output()
For more information see: http://www.josephspurrier.com/prevent-escaping-exec-command-arguments-in-go/ and exec with double quoted argument
I just deleted all carriage returns in xml
and removed Tag
.
And
appcmd add apppool /in < C:\Installs\AppPool.xml
worked for me.
I am trying to deploy my webproject using msbuild tool in command line as shown below -
msbuild MyWebProject.vbproj /p:DeployOnBuild=true
/p:PublishProfile="MyWebProject - Web Deploy - Test"
/p:Configuration=Debug
But I am getting following error -
msdeploy error ERROR_COULD_NOT_CONNECT_TO_REMOTESVC: Web deployment task failed. (Could not connect to the remote computer ("MyWebProject.scm.azurewebsites.net") using the specified process ("Web Management Service") because the server did not respond. Make sure that the process ("Web Management Service") is started on the remote computer. Learn more at: http://go.microsoft.com/fwlink/?LinkId=221672#ERROR_COULD_NOT_CONNECT_TO_REMOTESVC.) [C:\XXXX\XXXX\MyWebProjectSolution\MyWebProject\MyWebProject.Web.vbproj]
Here is the Publish Profile I am using -
<?xml version="1.0" encoding="utf-8"?>
<!--
This file is used by the publish/package process of your Web project. You can customize the behavior of this process
by editing this MSBuild file. In order to learn more about this please visit http://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<WebPublishMethod>MSDeploy</WebPublishMethod>
<ADUsesOwinOrOpenIdConnect>False</ADUsesOwinOrOpenIdConnect>
<LastUsedBuildConfiguration>Debug</LastUsedBuildConfiguration>
<LastUsedPlatform>Any CPU</LastUsedPlatform>
<SiteUrlToLaunchAfterPublish>http://MyWebProject.azurewebsites.net/tMyApp</SiteUrlToLaunchAfterPublish>
<LaunchSiteAfterPublish>True</LaunchSiteAfterPublish>
<ExcludeApp_Data>False</ExcludeApp_Data>
<MSDeployServiceURL>MyWebProject.scm.azurewebsites.net:443</MSDeployServiceURL>
<DeployIisAppPath>MyWebProject/tMyApp</DeployIisAppPath>
<RemoteSitePhysicalPath />
<SkipExtraFilesOnServer>False</SkipExtraFilesOnServer>
<MSDeployPublishMethod>WMSVC</MSDeployPublishMethod>
<EnableMSDeployBackup>True</EnableMSDeployBackup>
<UserName>$MyWebProject</UserName>
<_SavePWD>True</_SavePWD>
<_DestinationType>AzureWebSite</_DestinationType>
<PublishDatabaseSettings>
......
</PublishDatabaseSettings>
</PropertyGroup>
<ItemGroup>
<MSDeployParameterValue Include="$(DeployParameterPrefix)MyWebProjectDB-Web.config Connection String">
<UpdateDestWebConfig>False</UpdateDestWebConfig>
</MSDeployParameterValue>
</ItemGroup>
</Project>
When I manually publish my web app using the same publish profile file, it works just fine.
Here is the request and Response msbuild makes (captured using fiddler) -
------- Raw Request -----
CONNECT MyWebProject.scm.azurewebsites.net:443 HTTP/1.1
Host: MyWebProject.scm.azurewebsites.net
Proxy-Connection: Keep-Alive
------- Auth -----
No Proxy-Authorization Header is present.
No Authorization Header is present.
------- Raw Response -----
HTTP/1.1 0 Connection passed to Gateway - Result unknown
EndTime: 10:26:35.164
Please see the image below for details of fiddler request.
Any idea what might be going wrong with my msbuild command ?
I ran into this issue, for me the fix was to add my ip to the SCM site restrictions:
Azure portal -> Your app service -> Networking -> Configure Access Restrictions -> scm tab -> Add rule
https://learn.microsoft.com/en-us/azure/app-service/app-service-ip-restrictions#restrict-access-to-an-scm-site
I have an MVC6 Beta8 app that works locally. However when I publish it to Azure and open a home page, it return Error 500 "The page cannot be displayed because an internal server error has occurred.".
I enable the logs, but can only see kudu logs and http raw logs
2015-10-16 07:38:48 RENT-A-BIKE GET / X-ARR-LOG-ID=3c27af78-3874-4482-ac68-db29581070c1 80 - 112.207.250.32 Mozilla/5.0+(Windows+NT+10.0;+WOW64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/46.0.2490.71+Safari/537.36 .AspNet.Microsoft.AspNet.Identity.Application=CfDJ8HSojZD46JRKpzcRvF66TcKzVHMrCLJRTTbz0MjK8rYaNUpfZzWwtz9EclfXXiMRUJ86IxNB_tWT5UhG03TptxP2tAXaedN0W1bQsMPhoeZR_OUrN5T0JeKZ8YAyqQkSfMmJo2rSphQFPfor7ztnbhs7vXaL0tYmsdflHAaRJH0nWs05vWuDfBkVnf7VofdoK5pICbz_QZ-HyNiH1dBzbl7CKvnzrpU7Erz4_hM4FPpAgY3hVRSuLuSYq8s9xnFNeLXI52u0DUU7GTwNYXZ946_wvjnIx706R6m4rh1c4__fLDNR6x2kPPHwWzKyftbhI3ETToJjAVtmNglY0WG9hCfZvZ_V_iCPWNmowfeU3YZ2Ux1lcDaHzr9o1o0T5ounqTzMqs_HzflN08-o7-xYF7BaqTOSjuScIWdpYDpXdzi7GAP3Hm7JPC3BG4A2GCoMjJpPDMDz6Aof9P0Td0EFB6XafDtduMewIZxf8-bGykUqoCgCb2i0dO21PFU-qkcg9kJ0LCm0kGdLERsEFLy4_a2X5vEBiyWIAlYu1JCb95l0FW87TcsMe1HwvsvubS4OkyIcKEo4UyX61AGPoRbf8OjXVvzYedG53mYdFVwsp2UARwmkGOqalp2ljGXYNCFtFkHc84ggj6XAvnnnvDCJDRAzABsNxm-b8mXtFEhgBKdzpS8Yn0egmHQNhDGP-hJy2hF-QJl8LnxjEpXg4yFtUaod54Y1_mopW11rkoWdz6aM4prIOf09TrG4NL4Y_1Ohgw;+_ga=GA1.3.68280290.1444933317;+ARRAffinity=e3c351936b5fcfb74e537a7dc58aebd6a3183747ae4ea853fe04b8e76e10ac5d - rent-a-bike.azurewebsites.net 500 19 183 466 1727 251
2015-10-16 07:38:48 RENT-A-BIKE GET /favicon.ico X-ARR-LOG-ID=5aaf9cc0-3594-4751-8571-197cc8465cef 80 - 112.207.250.32 Mozilla/5.0+(Windows+NT+10.0;+WOW64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/46.0.2490.71+Safari/537.36 .AspNet.Microsoft.AspNet.Identity.Application=CfDJ8HSojZD46JRKpzcRvF66TcKzVHMrCLJRTTbz0MjK8rYaNUpfZzWwtz9EclfXXiMRUJ86IxNB_tWT5UhG03TptxP2tAXaedN0W1bQsMPhoeZR_OUrN5T0JeKZ8YAyqQkSfMmJo2rSphQFPfor7ztnbhs7vXaL0tYmsdflHAaRJH0nWs05vWuDfBkVnf7VofdoK5pICbz_QZ-HyNiH1dBzbl7CKvnzrpU7Erz4_hM4FPpAgY3hVRSuLuSYq8s9xnFNeLXI52u0DUU7GTwNYXZ946_wvjnIx706R6m4rh1c4__fLDNR6x2kPPHwWzKyftbhI3ETToJjAVtmNglY0WG9hCfZvZ_V_iCPWNmowfeU3YZ2Ux1lcDaHzr9o1o0T5ounqTzMqs_HzflN08-o7-xYF7BaqTOSjuScIWdpYDpXdzi7GAP3Hm7JPC3BG4A2GCoMjJpPDMDz6Aof9P0Td0EFB6XafDtduMewIZxf8-bGykUqoCgCb2i0dO21PFU-qkcg9kJ0LCm0kGdLERsEFLy4_a2X5vEBiyWIAlYu1JCb95l0FW87TcsMe1HwvsvubS4OkyIcKEo4UyX61AGPoRbf8OjXVvzYedG53mYdFVwsp2UARwmkGOqalp2ljGXYNCFtFkHc84ggj6XAvnnnvDCJDRAzABsNxm-b8mXtFEhgBKdzpS8Yn0egmHQNhDGP-hJy2hF-QJl8LnxjEpXg4yFtUaod54Y1_mopW11rkoWdz6aM4prIOf09TrG4NL4Y_1Ohgw;+_ga=GA1.3.68280290.1444933317;+ARRAffinity=e3c351936b5fcfb74e537a7dc58aebd6a3183747ae4ea853fe04b8e76e10ac5d http://rent-a-bike.azurewebsites.net/ rent-a-bike.azurewebsites.net 500 19 183 466 1696 31
I also tried to disable custom errors in web.config, but it doesn't work (and as I understand starting from Beta8 is not supposed to work).
How can I troubleshoot this problem to see an actual error that occurred?
After I enabled "Detailed Error Messages" is Azure web app configuration, I was able to see DetailedErrors folder in Log Files directory that had a number of .html files with error details.
For that detailed errors begins appear in DetailedErrors folder in Log Files directory - restart your application in Azure.
In project.json file, for the web command specify the environment parameter = development
"commands": {
"web": "Microsoft.AspNet.Server.Kestrel --ASPNET_ENV development",
}
In the Startup.cs file, in Configure you should have:
if (env.IsDevelopment())
{
app.UseBrowserLink();
app.UseDeveloperExceptionPage();
app.UseDatabaseErrorPage();
}
else
{
app.UseExceptionHandler("/Home/Error");
}
This means that when you run in other hosting environment that development, the Error page will be displayed instead the DeveloperExceptionPage.
I did this
http://reboltutorial.com/images/rebol-iis.png
as explained here but it was for IIS 6
http://rebolforum.com/index.cgi?f=printtopic&topicnumber=39&archiveflag=new
I also activated 32 bits for application pool as explained here
http://blogs.iis.net/wadeh/archive/2009/04/13/running-perl-on-iis-7.aspx
But when browsing to the test script it doesn't work, seems to take forever showing nothing, then in the end shows this message error:
502 - Web server received an invalid response while acting as a gateway or proxy server.
There is a problem with the page you are looking for, and it cannot be displayed. When the Web server (while acting as a gateway or proxy) contacted the upstream content server, it received an invalid response from the content server.
I used a dedicated server on windows 2008
Source code of the test script:
REBOL [Title: "Cgi Test in Rebol"]
print "HTTP/1.0 200 OK^/Content-type:text/html^/^/";
print []
print ["Date/time is:" now]
print []
Should I ask on serverfault rather as nobody seems to know here ?
Finally I got my answer, here are the steps:
Open Server Manager from Administrative Tools.
Add role "Web Server (IIS)"
Try http://localhost/ from your browser. You should see the IIS7 Welcome Page.
Copy core.exe to c:\ (or somewhere else), right click on core.exe and open Properties window, give Read & Execute access to IUSR_xxxx under Security tab. (If you've any problem, try to give Read & Execute for Everyone)
Open "Internet Information Services (IIS) Manager" from Administrator Tools.
Click on Default Web Sites, double click on Handler Mappings, click on Add Module Mapping from the right panel and type the followings:
Request Path: *.r
Module: c:\core.exe -cs %s %s
Name: Rebol
Select Yes when Add Script Map dialog box appears. It will add the c:\core.exe -cs "%s %s" as allowed under ISAPI and CGI Restrictions list.
Create a test.r file under wwwroot folder. My test.r file contains following script:
R E B O L [Title: "Server Time"]
print "content-type: text/html^/"
print [<HTML><BODY>]
print ["Date/time is:" now]
print [</pre></BODY></HTML>]
And type http://localhost/test.r on your browser.
If everything goes well then it should work.
If you are trying with View.exe then you may need to put --noinstall to command line, otherwise when View start with IUSR_xxx user account it will open desktop & installation window and it stays background (you can see it from Task Manager).
c:\view.exe -csi %s %s
You may also need to put double quotes around %s if your script is in a path with spaces. Use the following form:
c:\core.exe -cs "%s %s"
Instead of this:
c:\core.exe "-cs %s %s" (<-- this won't work!)
I hope this will help.
UPDATE: I've faced a problem on IIS6 (Windows 2003 Server), it gives 404 when I configure it as follow (it works on IIS7 as told above):
c:\core.exe -cs "%s %s"
But it runs as:
c:\core.exe" -cs "%s" %s
Here is the link for Perl installation.
http://www.howtogeek.com/50500/how-to-install-perl-on-iis-6-for-windows-server-2003/