Menu
  • HOME
  • TAGS

Azure websites RoleEnvironment.IsAvailable equivalent [duplicate]

Tag: azure,azure-web-roles,azure-web-sites

This question already has an answer here:

  • How to check if code is running on Azure Websites 2 answers

I'm migrating an web app from an Azure Cloud Services Web Role to Azure Websites. Websites can't find Microsoft.WindowsAzure.ServiceRuntime and doesn't seem to like the Cloud Service helpers in general.

The app uses RoleEnvironment.IsAvailable in a few places to behave differently online versus on a development computer. (We ran in development outside of the Web Role emulator for speed.)

Is there an equivalent property to RoleEnvironment.IsAvailable for determining whether the app is running in the cloud?

Best How To :

There are many ways to differentiate running on Azure Websites of in a development environment.

If it's in the context of a request then I would go with checking the host if it's localhost vs mysite.com for example.

Another option is to check any of the Environment Variables that Azure websites injects in your site. You can find a list in here https://<yourSiteName>.scm.azurewebsites.net/Env

Finally you can define your own AppSetting in Azure Portal for the site, then check it's existence to know which environment you are running on.

How to set-up Wordpress Multi-sites on Azure using sub-directories

wordpress,azure,multisite

This stackoverflow question on IIS has the answer: getting 404 error on admin panel for sub-directory multisite on a sub-domain in wordpress It gives this XML for the web.config <?xml version="1.0" encoding="UTF-8"?> <configuration> <system.webServer> <rewrite> <rules> <rule name="WordPress Rule 1" stopProcessing="true"> <match url="^index\.php$" ignoreCase="false" /> <action type="None" /> </rule> <rule...

Unable to publish to Azure after 2014 update

asp.net,asp.net-mvc,azure,sql-azure

There are multiple options available to you, but I think below 2 best meet your demand: Integrated in Visual Studio you have the SQL Server Data Tools. When you switch the target for the deployment to Azure SQL DB you'll get the list of incompatibilities, which you can then fix...

SoapException: Host is not known, only when called from WebService

asp.net,web-services,azure

The error message was a bit of a red herring. Turns out the problem was that the external web service was throwing a 500. We solved that and the error disappeared.

Domain redirection to Azure subscription

azure

you need to configure a new custom domain for you Azure Web App. You can follow the tutorial: https://azure.microsoft.com/en-us/documentation/articles/web-sites-custom-domain-name/

How to expose existing REST API through Azure Service Bus (or through something else)

rest,azure,azureservicebus

If you want to access an On-Premise service from the Azure service/websites what you need is a Hybrid Connection. For that you will need a BizTalk service to redirect the trafic to your on-prem service. Here are the steps to how to setup a Hybrid connection: https://azure.microsoft.com/en-us/documentation/articles/web-sites-hybrid-connection-get-started/...

Upload file to Azure Blob from HTML webpage (C#)?

c#,azure,file-upload,azure-storage-blobs

You should not try to cast UploadedFile.InputStream to a FileStream. CloudBlockBlob.UploadFromStream requires a Stream object, so it should be able to work directly with UploadedFile.InputStream.

website creation fails with serverfarm not found Azure Powershell

json,powershell,azure,server-farm

It looks like the web app is unable to find the server farm (AKA app service plan) since it's in a different resource group. To fix this, try creating the ServerFarm and web app in the same resource group. i.e. use this command: PS C:\scripts> New-AzureResourceGroup -Name "azurepowershellush" -TemplateFile F:\DeployerScript\Acquiacom.AcquiaDrupal7SQL.0.3.16-preview.json...

Distributed session implementation detail

c#,asp.net,session,azure

Yes, session state assumes that provider deserializes/serializes whole state and hence more data is stored more time it takes to start/end request. As an option if you need to store a lot of data - store infrequently needed pieces outside of session state and keep information on location of the...

Azure Mobile Services: migrate to non-Azure Windows Server

asp.net,azure,azure-mobile-services

It is entirely possible to move the .NET runtime - This is just an ASP.NET Web API site, and it can be hosted anywhere that you might run ASP.NET. However, some features such as the login functionality will not be available. For the Node.JS runtime, the actual process running the...

Different output when run on Azure than on local build

c#,asp.net-mvc,azure,encoding

I suspect there is a difference in the local and remote configuration. I would check the environment variables for your web app, and compare them with your local app to see if there's any differences (i.e. CLR version, IIS version). You can check environment variables with the SCM site, which...

Azure Mobile Service requires authentication for SignalR HTML/Javascript Client

azure,signalr,azure-mobile-services

Have you looked at this blog post? http://blogs.msdn.com/b/azuremobile/archive/2014/05/30/realtime-with-signalr-and-azure-mobile-net-backend.aspx You can set your authorization globally with: public static void Register() { // Initialize SignalR SignalRExtensionConfig.Initialize(); // Use this class to set configuration options for your mobile service ConfigOptions options = new ConfigOptions(); options.SetRealtimeAuthorization(AuthorizationLevel.Anonymous); ... } ...

Trying to use Java Message Service (JMS) API with Service Bus and AMQP

java,maven,azure,amqp

Solved by downloading the jars separately and installing them into the Maven repository according to this document: How to add local jar files in maven project? Then adding the pom definitions from the jar installs into the project's pom.xml file....

Azure - Enable diagnostics for worker/web role

azure,logging,azure-diagnostics

To answer your questions: No WAD containers are created in my storage account. Are they not supposed to be created after I have enabled and specified the storage account credentials? If you're looking for wad-control-container, then it won't be created. However you should see containers for IIS Logs, Failed Request...

Error deploying database to SQL Azure

sql-server,azure,forms-authentication,sql-azure

This was solved by generating a SQL Azure script for the DB, and running it on Azure. Here's how I solved it: First, open SQL Server, right click the database you want to transfer and click "Tasks > Generate Scripts..." Next, click "Advanced" on the scripting options panel and find...

How can I add a .props file to a C# project?

azure,visual-studio-2013,azure-webjobs

From my understanding in this article it is enough that you add a new text och xml file and name it WebJobs.props. Look also at the screenshot explaining how you should edit it. Here is a different example of this file. https://github.com/davidebbo-test/WebAppWithWebJobsVS/commit/15e7579075312d620fe42a8746503ba82adf5305

Does SQL Azure support REPLACE T-SQL function with cyrillic characters?

sql-server,tsql,azure,sql-azure,management-studio-express

The replace function itself works in Azure SQL Database. What does not work in SQL Database is USE [aaa]. You have to connect to the correct database first and then issues the statement in....

Application for viewing Azure service bus dead letters

azure,azureservicebus,dead-letter

After a few creative searches later, I have found the project "Service Bus Explorer" by Paolo Salvatori that does exactly what I need. I hope this helps out other people searching for the same thing. It can be found on the code.msdn.microsoft.com site under Microsoft Azure and Sample code. https://code.msdn.microsoft.com/windowsazure/Service-Bus-Explorer-f2abca5a...

Azure Active Directory Graph Client 2.0 - Contains Expression

c#,azure,active-directory,graph-api-explorer

Contains is generally not supported by the Graph API itself. And there is no alternative. It is strange that EndsWith works. You can find more about supported queries and filters on the following official documentation: https://msdn.microsoft.com/en-us/library/azure/dn727074.aspx...

Handling service bus Message.Complete() exceptions

c#,azure,servicebus,idempotent

I have similar challenges in a large scale Azure platform I am responsible for. I use a logical combination of the concepts embodied by the Compensating Transaction pattern (https://msdn.microsoft.com/en-us/library/dn589804.aspx), and Event sourcing Pattern (https://msdn.microsoft.com/en-us/library/dn589792.aspx). Exactly how you incorporate these concepts will vary, but ultimately, you may need to plan on...

Azure : HOWTO/BEST-Practice : Publish WebApp with Webjob using blobs Q's to multiple destinations?

visual-studio,azure,windows-azure-storage,publish

If i understand your question : set key in your App webconfig with dummy values <appSettings> <add key="BLOBAzure1" value="Check Azure" /> </appSettings> Get connection string for blob at runtime with something like this: CloudStorageAccount storageAccount = CloudStorageAccount.Parse( CloudConfigurationManager.GetSetting("BLOBAzure1")); Inside Azure Panel go to your Web app properties and set REAL...

It was not possible to connect to the redis server(s); to create a disconnected multiplexer

c#,azure,azure-redis-cache

The error you are getting is usually a sign that you have not set abortConnect=false in your connection string. The default value for abortConnect is true, which makes it so that StackExchange.Redis won't reconnect to the server automatically under some conditions. We strongly recommend that you set abortConnect=false in your...

How to override Azure Sql connection in Azure portal

entity-framework,azure,sql-azure

Ok I found an answer relative to my issue, but also I figured out something First of all the connection string should be like metadata=res://*/DataAccess.MyDataBase.csdl|res://*/DataAccess.MyDataBase.ssdl|res://*/DataAccess.MyDataBase.msl;provider=System.Data.SqlClient;provider connection string="Server=tcp:server.database.windows.net,1433;Database=MyDataBase;User [email protected];Password=xxxxxx;Trusted_Connection=False;Encrypt=True;Connection Timeout=30;" And notice the quotation should be " not &quot; , Also as Nick said it...

Azure - is one 'block blob' seen as one file?

azure,windows-azure-storage,azure-storage-blobs

Each blob is a completely separate entity, direct-addressable via uri: http(s)://storageaccountname.blob.core.windows.net/containername/blobname If you want to manage multiple entities (such as image jpg's in your case), you would upload each one to a separate blob name (and you're free to store as many as you want within a single container, and...

Kestrel Running which framework?

azure,asp.net-5,dnx,dnvm,.net-5.0

In Visual Studio 2015, the framework used is determined in this order: The project properties. Right-Click the .xproj in your Solution Explorer and select Properties. Head to the "Application" section (the default), and you can "Use Specific DNX version", including version, platform, and architecture. The global.json. I don't know if...

View local Azure Webjobs SDK dashboard for debugging WebJobs SDK console process

azure,azure-webjobs,azure-webjobssdk

TO get the Dashboard to run locally you can sync the dashboard sources from GitHub (https://github.com/azure/azure-webjobs-sdk) and add your Storage connectionstring and run the dashboard locally.

How to set ContentDisposition using Set-AzureStorageBlobContent

powershell,azure

You're not doing anything wrong. I don't think ContentDisposition is supported just yet in Azure Cmdlets (It is fully supported in REST and .Net API though). I am basing my statement on the source code here: https://github.com/Azure/azure-powershell/blob/dev/src/ServiceManagement/Storage/Commands.Storage/Blob/Cmdlet/SetAzureStorageBlobContent.cs. Source code from the same page: //only support the common blob properties for...

Azure, login to separate accounts with one email

azure,azure-active-directory

You can only view subscriptions for a single directory at a time. If you click your name in the top right corner of the portal you can select which directory you want to work from. There is a suggestion on the Azure feedback site to add the ability to view...

Getting error 400 bad request when accessing Azure blob storage - all latest components

azure,windows-azure-storage,azure-storage-blobs

Please take a look at the following articles for monitoring, diagnosing, and troubleshooting Microsoft Azure Storage. Monitor, diagnose, and troubleshoot Microsoft Azure Storage End-to-End Troubleshooting using Azure Storage Metrics and Logging, AzCopy, and Message Analyzer ...

setting up azure ad certificate auth using powershell

powershell,azure,azure-active-directory

The 'value' field for the key credentials is always returned as 'null' for applications and service principals.

TelemetryClient does not send any data unless Flush is called

azure,ms-application-insights

For performance reasons, the Application Insights SDK batches telemetry and sends it up in chunks. To see this in action you can replace your Flush call with a call to Thread.Sleep (70000) and you will see the instrumentation uploaded to AI once the app terminates.

How to avoid a 404 when deleting batches from Azure Table Storage

c#,.net,azure,azure-table-storage

You could PUT empty entities with the same PartitionKey and EntityKey before DELETEing them. This way you'll be sure you won't have 404 errors. It's two consistent calls for every batch instead of retrying many times and complicate the logic of your app. Not an ideal answer but we don't...

PHP MSSQL Database Azure

php,sql-server,json,azure

You need to: Find out the public IP of your free web hosting provider (the public IP that your PHP script uses to make calls. And this with free web hosting provider means that this IP will most likely change on an irregular basis. Check the Azure SQL Database Firewall...

A parameter cannot be found that matches parameter name 'MaxSizeGB'

azure,sql-azure,azure-powershell

Business and Wed editions are a deprecated service level. Now, the service levels are Free, Basic, Standard & Premium as the error shows. About the parameter, are you using the Azure PowerShell module configured as "Resource Manager" or "Service Management"? The first one hasn't that value but the second one...

ShardMapManager.TryGetRangeShardMap wont retrieve the RangeShardMap

c#,azure,sql-azure,azure-elastic-scale

This was a silly mistake from my side. I was about to close this question but thought to post my mistake here as it might be helpful to someone else. The code to call this function was like this: RangeShardMap<int> shardMap = ShardManagementUtils.CreateOrGetRangeShardMap<int>(shardMapManager, Configuration.ShardMapName); Notice the int which tells the...

Add azure db to mvc5 project

asp.net,azure,visual-studio-2013,asp.net-mvc-5,sql-azure

I think that you need to create the DB in Azure from the Azure control panel. Once it is there, EF can use the connection string for Azure to add tables/data to an existing DB. Due to the configuration requirements of Azure DB, I haven't found any option but the...

When upload Bitmap stream to Azure storage, it store zero/empty image

asp.net-mvc,azure,cloud

I think you need to set the position back to the start of the stream before uploading img.Save(memoryStream, System.Drawing.Imaging.ImageFormat.Png); blob.Properties.ContentType = model.File.ContentType; memoryStream.Position = 0; blob.UploadFromStream(memoryStream); ...

Excel file (azure blob) does not download in chrome

excel,azure,azure-storage-blobs

You missed blockBlob.SetProperties(); Try this: var blockBlob = container.GetBlockBlobReference(randomFileName); blockBlob.DeleteIfExists(); blockBlob.Properties.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; blockBlob.SetProperties(); // This is for commiting changes. Note that for .xls files you need to set content-type to application/vnd.ms-excel. FYI: If you want to update property values in existing blob you need to fetch the current values,...

Is there a way to implement a wcf service connected to a database without paying for azure?

database,wcf,azure,windows-phone-8

Here are some interesting articles about WCF Services in Windows Phone world. How to consume an OData service for Windows Phone 8 Using WCF Service in Windows Phone 8.1 (same in Windows Phone 8) Now you can host the WCF Service in your own server, hosting provider or anything else....

connect to mysql database which is in ubuntu server

php,mysql,ubuntu,azure,virtual-machine

1) change my.conf (whatever your mysql conf file is called). And set bind-address to 0.0.0.0 as it is prob 127.0.0.1 2) stop/restart mysql daemon Connections now are not limited to those from localhost (what you are when you ssh). The default is localhost for obvious security reason until dev guy...

Azure NextMarker

azure,windows-azure-storage,azure-storage-blobs

Actually the query string parameter is marker and not nextmarker (https://msdn.microsoft.com/en-us/library/azure/dd135734.aspx) :). So if you try: https://attosolstorage.blob.core.windows.net/files?comp=list&maxresults=1&marker=1!16!aW1nL3JlZC5qcGc-, things should work just fine....

How to set network security group rules for azure storage services?

azure,sql-azure,azure-table-storage,windows-azure-networking

You cannot use network security rules for Azure Storage Services because: Azure Storage Services are not part, and cannot be part of (as of 2015-06-12) a Virtual Network. You cannot determine IP range for an Azure Storage Account, as the actual server serving particular request can change in any time...

Setup Codeigniter For Windows Azure

php,codeigniter,azure

I have downloaded the Codeigniter3.0 from the official site: http://www.codeigniter.com/download, and set session to autoload then publish it to Azure web app, everything goes well, there is no special configurations in my testing, from the error message, it seems the resource is missing, I would suggest you use Kudu to...

How can I view asp.net Azure internal errors?

asp.net,azure

If this is for a Azure Web App, you can enable Application Logging to write errors to the file system. You can also enable Failed Request Tracing (FREB) to see what is happening with the request. For a complete list of logging for Azure App Service (formerly Azure Websites), please...

Validate access token for WEB API protected by Azure AD

azure,asp.net-web-api,azure-active-directory

In your service start up you register OWIN and when your controller is decorated with Authorize attribute then the authentication challenge will happen and OWIN will try to validate the token on each request.. The token validation happens because you have OWIN Dll references AND you have the startup.auth class...

Slow Azure Table Search and Insert Operations on small tables

azure,azure-storage-tables

You can refer to this post for possible performance issues: Microsoft Azure Storage Performance and Scalability Checklist. The reason why you can only get one property is you're using EntityResolver, please try to remove that. Refer to Windows Azure Storage Client Library 2.0 Tables Deep Dive for the usage of...

the size of a string is the same size of a image after convert the image into string?

c#,string,azure

To split long string into collection of multiple shorte strings use String.substring. Something like: var slices = Enumerable.Range(0, longString.Length/ blockSize + 1) .Select(blockIndex => longString.Substring( startIndex: blockIndex * blockSize, length: Math.Min(longString.Length - blockIndex * blockSize, blockSize))); Note that approach with slicing of the string requires sending multiple messages to satisfy...

Access Registry From WebJob/WebApp

powershell,azure,azure-web-sites,azure-webjobs

You cannot achieve this with a WebApp. Because WebApps run in a multi-tenanted environment access to the registry is restricted. This page contains a feature comparison between WebApps and WebRoles. https://azure.microsoft.com/en-gb/documentation/articles/choose-web-site-cloud-service-vm/...

Control access to web apps on Azure

azure,azure-web-sites

If you haven't looked into API Apps, you will find a lot of functionality already existing there. For example, limiting the visibility of the API App is as simple as going to the API App blade -> All Settings -> Application Settings and setting the Visibility to "Internal". This will...

Can I run SignalR hub through Azure API Management?

c#,azure,signalr,azure-api-management

websocket is currently not supported in Azure API Management. Please feel free to raise a feature request: http://feedback.azure.com/forums/248703-api-management/filters/new

Azure WebJob or Scheduler or another technology?

azure,azure-webjobs

You have a few options: Web Jobs, Scheduler, and Worker Roles. Web Jobs are a nice addon to an existing azure web app and have the benefit of no additional cost. Web Jobs use Scheduler under the covers if you choose to schedule the Web Job to run at an...