Azure Cloud Service Virtual Directory Issue - azure

I am trying to add virtual directory in WebRole1 of my could service using following directive in csdf file...
<Site name="Web">
<VirtualDirectory name="aspnet_client" physicalDirectory="..\..\..\crazureresource\aspnet_client" />
<VirtualDirectory name="Downloads" physicalDirectory="..\..\..\crazureresource\Downloads" />
<Bindings>
<Binding name="Endpoint1" endpointName="Endpoint1" />
</Bindings>
</Site>
The development machine directory structure is...
..\CR1\CR1\ProjectFiles
..\CR1\crazureresource\aspnet_client
..\CR1\crazureresource\Downloads
The azure webrole1 directory structure is...
siteroot\0\website-deployed-files
siteroot\crazureresource\aspnet_client
siteroot\crazureresource\Downloads
The package gets published successfully; instance is also updated but WebRole's status is either 'Busy' or 'Restarting'. The website is not deployed on the webrole. If I shorten the path of virtual directory to
> ..\..\..\aspnet_clients and ..\..\..\Downloads
It works (the deployment); but the contents are modified on azure cloud service. In place of these physical folders a new folder by the name of 1 and 2 are created. Inside these two replacement folders, config files are placed by system - the original files are replaced. While at the same time in IIS, a valid link shows for virtual directory.
I am not able to access the resources from virtual directory due to this!

For Azure this is the valid directory structure
siteroot\0\website-deployed-files
siteroot\1\ ----name it as aspnet_client
siteroot\2\ ----name it as Downloads
and the contents will be availble like below urls
www.exapmple.com --- default (website-deployed-files)
www.exapmple.com/aspnet_client --contents of (aspnet_client)
www.exapmple.com/Downloads --contents of Downloads
you can update you local directroy structure to match.
for the path in csdef file
physicalDirectory="..\..\..\crazureresource\Downloads"
This is the path from /bin directory of Azure project to the Other projects Downloads.csproj directory.
Refer this for updating the Path properly in your csdef file
Hope this helps.

Related

Deleting an application directory from iss with appcmd and reports identifer needed

I have somehow created an application directory with the appcmd command that has hidden all of my applications directory.
I can do a list of my application directories with appcmd and I think the last directory I created has the file path with a double quote character at the end, so I'm trying to delete that one application directory.
When I run the command appcmd list app I get the list of my application directories which do not show up in the UI.
Here is a list of the last three:
APP "Default Web Site/hotele/language90" (applicationPool:DefaultAppPool)
APP "Default Web Site/hotele/business900" (applicationPool:DefaultAppPool)
APP "Default Web Site/hotelk" (applicationPool:DefaultAppPool)
When I attempt to delete the hotelk one which is the one I think is messing up all of the directories I try running this command:
appcmd delete app "Default Web Site"/"hotelk"
It gives me this error:
message:Must use exact identifier for APP object with verb DELETE.
I've tried many different combinations of this delete syntax and not use what is meant by the identifier?
I can't delete this application directory with the IIS UI since when I go there all of my application directories do not appear.
First of all try to delete the app from Internet Information Services (IIS) Manager GUI.
If you can't find your app there you can manually edit IIS configuration file (ApplicationHost.config):
Go to path %windir%\system32\inetsrv\config
Create a backup of ApplicationHost.config file
Open ApplicationHost.config file
Search the name of the app you want to remove (ex. hotelk). You should find it in the <sites> section:
<sites>
<site name="Default Web Site" id="1">
...
</site>
<site name="hotelk"" id="2">
<application path="/">
<virtualDirectory path="/" physicalPath="d:\test" />
</application>
<bindings>
<binding protocol="http" bindingInformation="*:80:" />
</bindings>
</site>
<siteDefaults>
...
</siteDefaults>
<applicationDefaults applicationPool="DefaultAppPool" />
<virtualDirectoryDefaults allowSubDirConfig="true" />
</sites>
remove the entire node containing the site you want to delete
save the file
If you want delete the app using appcmd this is the right command:
appcmd delete app "Default Web Site/hotelk"

How to allow web.config files as normal files and allow download IIS inside a virtual directory

I am working on a Unity 3D game which upon build for Windows generates game.exe and game_Data file and folder. The Game_Data folder contains a directory called **Game_Data\Mono\etc\mono\2.0**.
The directory files are shown in image.
The Browsers directory contains one file called Compact.browser.
The Current Scenario.
1. These game files are hosted on a server where IIS 7.5 is running.
The game resource files are served in virtual directory of the game website.
I've made few changes to the website's root web.config file so that all filetypes are allowed to download only in the game resources folder on server.
Yes, all file types including .html, .aspx, .xml, .config, .browser, .map etc are all downloading as normal files.
The problem
As you see the directory structure there is a web.config file inside the game resources folder. The file has nothing to do with website configuration but with the game (which is on client side after downloading).
As the files are served as individual files each file is downloaded separately. So when the client tries to download all files including the contents of the above folder.
Due to this web.config file, contents of the directory is not downloading. If I delete this web.config file all of the .aspx, .config, .map files are downloading. Also there are some other folders where many different files are downloading properly.
But this web.config file is also required for the game, and it is not allowing it be downloaded with other files too in the directory shown above.
I've tried to look into the solution. Found some hints to avoid inheritance in nested config files. But actually I want to completely treat this file as a normal file, not as a site configuration file.
I think you got my problem. Please let me know your suggestions. You can say adding Mime types. But actuall all of the file types are downloading including .config files. Except the file named web.config.
I'm having the same problem, and I think I found the solution: there is a way to tell IIS not to interpret web.config files.
To do this, modify the C:\Windows\System32\inetsrv\config\applicationHost.config file (I haven't found a way to do this in the IIS user interface), by specifying allowSubDirConfig="false" for the relevant <virtualDirectory> element:
<configuration>
<system.applicationHost>
<!-- ... -->
<sites>
<site name="Default Web Site" id="1">
<application path="/">
<virtualDirectory path="/" physicalPath="%SystemDrive%\inetpub\wwwroot" />
<virtualDirectory path="/Staging" physicalPath="C:\inetpub\wwwroot\Staging" allowSubDirConfig="false" />
</application>
<bindings> <!-- ... --> </bindings>
</site>
See http://www.iis.net/configreference/system.applicationhost/sites/site/application/virtualdirectory for the details.
The problem is, it still won't let you download the web.config file, it keeps returning a 404 - Not found, even after removing all handlers.
Edit - found the solution. The short answer is that in your web.config, you should clear the fileExtensions and hiddenSegments lists:
<system.webServer>
<security>
<requestFiltering>
<hiddenSegments>
<clear />
</hiddenSegments>
<fileExtensions>
<clear />
</fileExtensions>
</requestFiltering>
</security>
I've written a blog article about it that explains all the details.

Trying to create my .cspkg Azure package file, but getting an error "Need to specify the physical directory for the virtual path..."

When I try to package my Azure web app (to create the .cspkg and .cscfg files), I get the following error in my ServiceDefinition.csdef file:
Need to specify the physical directory for the virtual path
'AzurePOCWebRole/' of role AzurePOCWebRole
Here's my .csdef file:
I'm assuming the error is referring to my <Site name="AzurePOCWebRole"> piece. I try adding physicalDirectory to <Site name="AzurePOCWebRole" physicalDirectory="../AzurePOCWebRole">:
And try to create the package again, but I get the same error and it reverts that change I just made back to <Site name="AzurePOCWebRole">:
QUESTION: What can I do to resolve this error and create my package?
I was editing the "automatically generated" version of ServiceDefinition.csdef, which wasn't apparent because it didn't indicate it wasn't the actual file, so whenever I rebuilt, it reverted this file back to the original ServiceDefinition.csdef's file, which I WASN'T editing.

Transform external config in a web role

Can slowcheetah transform an external config file in an azure web role? e.g. I have logging info in log4net.config. But the transformed version does not get created when packaged.
I did not manage to get slowCheetah working in my Azure solution.
One alternative you can use is to create complete config files for each environment - e.g. :
log4net.debug.config
log4net.release.config
and copy the contents of these into the log4net.config at buildtime depending on the build configuration chosen.
This is done by adding a build target to your csproj file like so:
<Target Name="BeforeBuild">
<Delete Files="$(ProjectDir)log4net.config" />
<Copy SourceFiles="$(ProjectDir)log4net.$(Configuration).config"
DestinationFiles="$(ProjectDir)log4net.config" />
</Target>
(you may have to modify the paths in the script depending on where in the solution your config files are)
You can find more information on MSBuild and manipulating your .csproj file here and here

physicalDirectory and Redirection in azure

My .csdef file:
<?xml version="1.0" encoding="utf-8"?>
<ServiceDefinition name="SimpleAzure1.Azure" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceDefinition" schemaVersion="2012-10.1.8">
<WebRole name="SimpleAzure1" vmsize="Small">
<Sites>
<Site name="Web2" physicalDirectory="../../../SimpleAzure1/">
<Bindings>
<Binding name="Endpoint2" endpointName="Endpoint2" hostHeader="SimpleAzure1.cloudapp.net" />
</Bindings>
</Site>
</Sites>
<Endpoints>
<InputEndpoint name="Endpoint2" protocol="http" port="80"></InputEndpoint>
</Endpoints>
<Imports>
<Import moduleName="Diagnostics" />
</Imports>
</WebRole>
</ServiceDefinition>
And my project structure is:
I define physicalDirectory="../../../SimpleAzure1/" in .csdef but when I create a package and deploy in azure physicalDirectory's default.aspx page is not loaded.Its load a page from asp.net wepappliaction.When I define physicalDirectory in .csdef file why asp.net wepappliaction page is loading.Am I missing some thing.Thanks.
Concur with knightpfhor - if you only have one site, remove the physical directory and host header.
If you are using more than one site in the role, deployment changed from SDK 1.7 to 1.8:
The physicalDirectory attribute path is relative to the directory in
which the target Service Definition file resides when packaged. In
previous versions this file was located within the root project
directory. In this version, by default, this file is located in the
project output directory. You may need to update the relative path to
reflect the new location of the target Service Definition file.
To see where the files are actually located, enable remote access and RDP into the instance. Check the Physical Directory specified in IIS and then confirm that path exists and references the installed website, typically E:\sitesroot\0 or F:\sitesroot\0
If you only have one site in your web role then there is no need to specify the physical directory or the host header.I suspect the builder is taking some short cuts. Try removing the site from the role and adding it again and this time leave the defaults.

Resources