I have one project solution in which I have one web project and another project is service. Now if I run it locally, it is working fine without any problem but when I deploy it on to cloud (azure specifically), its looks up and starts running but moment it tries to access the service which is used for log in mechanism it is showing an error.
As I don't know how to trace it on to azure, I'm unable to find actual root cause of it.
While publishing it to azure, I have just marked my main project into web role. Do I need to add anything else in web role node while deploying package to azure?
To perform diagnostics during development, one useful technique is to activate Remote Desktop on the cloud instance and connect to the server to check the event logs for errors.
If you have Visual Studio Ultimate, you can also use Intellitrace to collect debugging information on the published cloud service. See Debugging a Published Cloud Service with IntelliTrace and Visual Studio.
You can also debug locally using the emulator. See Debugging a Cloud Service in Visual Studio.
As for your project architecture, you have a few alternatives:
Add a web role for each project; i.e., one web role for the web project and another web role for the service project. This will create two instance groups, and one of this roles will be assigned the TCP port 80; the other role will be assigned another port such as 8080.
Add both project in a single web role as distinct web sites. See Configure a Web Role for Multiple Web Sites, Tips for Publishing Multiple Sites in a Web Role, One Azure Web Role, Multiple Websites.
Reorganize your solution so that you have a single website project that also has the service definitions, and keep the service implementation in a separate class library project. This way you would have one web role and one web project with both the website and the services.
Related
Problem
Getting a deployment error when trying to publish to an Azure Web App from TFS CI. A file is locked and this prevents the build from updating.
Symptoms
Publishing manually (Web Deploy publish from within Visual Studio) usually succeeds.
Stopping the Web App and publishing allows it to succeed, however this defeats the point of our CI if we need need to stop and start the Web App each time.
CI publish to Web roles and Worker roles don't appear to have this issue, we only get it on publishing to Web Apps (formerly Web Sites, the current Azure Portal term is now App Service).
Only publishing from a CI build via TFS fails consistently in this way.
Error
Web deployment task failed. (Web Deploy cannot modify the file
'msvcr100.dll' on the destination because it is locked by an external
process. In order to allow the publish operation to succeed, you may
need to either restart your application to release the lock, or use
the AppOffline rule handler for .Net applications on your next publish
attempt. Learn more at:
http://go.microsoft.com/fwlink/?LinkId=221672#ERROR_FILE_IN_USE.)
The information at the link isn't very helpful.
ERROR_FILE_IN_USE
Diagnosis – A destination file cannot be overwritten or deleted because it is currently in use.
Resolution – Make sure that the destination file is not in use before performing a sync. If you are syncing content to a web site
hosted on IIS 7 or later (using the appHostConfig, iisApp, or
contentPath providers), consider taking the application offline during
the sync by enabling the appOffline rule.
Attempted resolutions
We were using New Relic - have since removed New Relic and this issue still persists. The binary appears to be a Microsoft library but it's unclear how it is relevant to the application (it's not referenced).
Some other SO questions have addressed similar issues with publishing but none of these relate to getting this issue from TFS CI.
azurew website continious deployment - Web Deploy cannot modify the file 'XXX' on the destination because it is locked by an external process
How to take web app offline while publishing?
One answer in the above question suggests using the EnableMSDeployAppOffline configuration in the publish profile, and adding this configuration works OK for doing a publishing manually from within VS but it doesn't fix the problem when publishing automatically from TFS/CI.
Edit
How to take web app offline while publishing? deals with taking the app offline using the EnableMSDeployAppOffline configuration - unfortunately this config only seems to be supported when doing WebDeploy through Visual Studio (not CI).
You can use the Web Deploy v3 in CI to deploy your web app.
In Web Deploy V3, we added support to automatically take an ASP.Net
application offline before publishing to it. This is useful if a user
wants to ensure that their application does not have a lock on a file
(e.g. SQL CE sdf files which only allow one connection to the file at
a time) being overwritten, or if they want to ensure that visitors to
their site cannot affect the publish process. When the publish process
is completed, the App_Offline.htm file will be removed and the site
will be online again.
Or you can add a PowerShell script like following to deploy the web app to Azure:
param($websiteName, $packOutput)
$website = Get-AzureWebsite -Name $websiteName
# get the scm url to use with MSDeploy. By default this will be the second in the array
$msdeployurl = $website.EnabledHostNames[1]
$publishProperties = #{'WebPublishMethod'='MSDeploy';
'MSDeployServiceUrl'=$msdeployurl;
'DeployIisAppPath'=$website.Name;
'Username'=$website.PublishingUsername;
'Password'=$website.PublishingPassword}
Write-Output "Stopping web app..."
Stop-AzureWebsite -Name $websiteName
Write-Output "Publishing web app..."
$publishScript = "${env:ProgramFiles(x86)}\Microsoft Visual Studio 14.0\Common7\IDE\Extensions\Microsoft\Web Tools\Publish\Scripts\default-publish.ps1"
. $publishScript -publishProperties $publishProperties -packOutput $packOutput
Write-Output "Starting web app..."
Start-AzureWebsite -Name $websiteName
Reference from: https://msdn.microsoft.com/en-us/Library/vs/alm/Build/azure/deploy-aspnet5
The new "Deploy AzureRM Web App" task has an option to take the app offline which will prevent this error.
See screenshot for checkbox
After update for the latest AzureMobile.Services.Backend.Tables package, when i try to run my application at IISExpress or LocalIIS appears this error:
Web server is not configured to list the contents of this directory.
Im aware that azure mobile service which is an asp.net web api does not have an home page which is generate on runtime.I tried to create a new azure mobile services and it works fine as well.
Am I missing something on my webconfig?
Solved by creating another project of Mobile Services with an default template.
This is my first time trying to develop a windows azure application on my visual studio 2010.
what I have done so far is:
Open new project > C# > Cloud.
Downloaded the SDK.
Add new class with code that only displays my name and age.
try to run this code locally and failed!
My questions is:
am I able to run the application locally? if yes the how?
How can I deploy the application? (I already have an account)
Well for what I see your problem is not your windows azure sdk, the thing is that you are creating a WorkerRole project which is a Class Library type and that won't give you an output, for that you need to create a WebRole project.
here I let you this tutorial, it would show you how to create your first WebRole project.
http://www.dotnetcurry.com/ShowArticle.aspx?ID=801
And this one would show you how to deploy on the cloud
http://www.developerfusion.com/article/125435/deploying-an-azure-application
What type of application are you trying to build? Your error is because you are trying to run a class library, which isn't an executable.
There are primarily two types of applications that are hosted in Azure:
Website - These are just standard ASP.NET WebForms or MVC projects, hosted on Azure. These are the easiest to get going, and with the latest Azure release, require nothing special. Simply create a Web project, and git deploy to your Azure Web Site
Worker Role - Worker roles are usually for background tasks like performing computations, sending emails, distributing work, etc. These can effectively be thought of as console applications that never end.
For example:
while(true)
{
// do work here
Thread.Sleep(5000);
}
When developing Azure applications, you need to either create a website (WebForms, MVC, WebAPI), a WCF service, or a console application to run as a background worker. Once you've built the application locally, then you can add an Azure Cloud project, which will handle the actual deployments.
Yes, you can run your application locally: Select the Azure application project in the Solution Explorer, right click, "Set as StartupUp Project" and run
To Publish: goto https://manage.windowsazure.com/ . Create a new web role and download the publishing settings.
Here
and here it is written how to convert a standard WCF Service to Windows Azure. It is written, that after right-click you will have an option to "Add Windows Azure Deployment Project". But still I do not see it in Visual Studio in my project after right-click at the WCF Application project.
This is the screenshot:
What is wrong? How to deploy it in Windows Azure?
As I told you in the other post this should normally work. But since it does not I propose copying over your WCF interfaces, classes and configurations to a brand new WCF Service Role project. Then you will be able to publish it to Windows Azure directly without any problems.
Please check the following link Code Quick Start: Create and deploy a WCF service in Windows Azure
I'm new to Windows Azure and I'm trying to deploy my web application to Windows Azure.
In my app I used some web services, now I would like to know how can I build them in windows azure and include that web reference in my web app?
Some tutorials said that I have to import my current web service into a Cloud Service Project as a WebRole but in my web serivce folder, there's no csproj file.
Thanks!
I found out that I just have to create a new Window Azure Project and add a WCF Service Web Role, copy my old files in the old Web Service (maybe change a little bit if it's ASMX) then host it the same way as web application. And voila, everything is ok now :)
I think you should use a WebRole for a web service, but you can use a WorkerRole though.
Take a look on this:
http://www.devproconnections.com/article/windows-azure-platform3/Hosting-WCF-Services-on-Azure-101.aspx