I am working on TCP/IP in Windows Azure and am successfully able to develop a TCP client to send and web-role to receive the TCP data.
I want to display this received data in a .aspx page. How should I access the webrole data from .aspx page?
Regards,
Anil
Having read the long comment stream, I think I get the essence of this scenario and question. It appears that there's some tcp-listener code being launched from within webrole.cs, not within the asp.net app code.
Here's the thing: A Web Role is Windows Server 2008 with IIS, along with some Windows Azure code for handling bootstrap and shutdown tasks. The webrole.cs file you speak of is the bootstrap/shutdown code entry point, with methods such as OnStart(), Run(), OnStop(), and Stopping(). This code is run in a separate AppDomain than your web app.
If you're launching a ServiceHost (or some other port listener) from webrole.cs, that's fine, but you'd need to then store content somewhere temporarily after it's uploaded, then make it available for your web app later. You could choose durable storage such as SQL Azure or Azure Storage (blobs or tables), or volatile storage (e.g. a local disk). You could then use some type of communication scheme to notify your web app that it has new data display, possibly by placing a message on an Azure queue, or having your web app just query a table for data each time a user requests it.
Related
I use data stored in in a blob for some configuration for some azure web apps, and I'd like to react to changes to it in near realtime. Currently I just set a timed event and periodically check if the etag of the blob has changed, and if it has then download the new blob.
This is ok, but I don't want to poll the blob too often, and I also want to be reactive. The devs changing the values in the blob want to be able to test the new values quickly.
The web app scales up and down, and each instance of the web app needs to download the config file. So, as far as I can tell, I can't just use the event system that azure storage has, as that would only send a notification to one instance.
Is there a recommended way to do this?
Per my understanding, you want to centralize manage your azure web apps. Once some config has been changed, your app services should reload configs on time automatically. Actually, Azure App Configuration provides this kind of functionality.
You can also config the condition to reload all configs in code. This is a .net core sample here. And you find other samples under the Enable dynamic configuration blade.
I'm thinking about setting up 2 web VMs with a load balancer and availability set, and another VM for SQL server (not sure if I can set an availability set for a SQL Server as well - SQL Server Express / Standard?)
My main problem is how to keep both web servers in sync (prefer not to use the DFS) or having the files in more than one location...
Another issue - is user uploaded content that I want to be available in both web servers (I wonder if I can also direct cache objects to be saved on a specific storage disk)
So, I was thinking to setup a storage account and attach it to both web VMs for user uploaded content and images while each server still serve it's own separate web application with same shared access to content files...
Is that a good idea? I understand that Azure storage is a virtual disk that is supposed to be highly available and fast - is it true??
Do I get a major performance hit if using the same storage disk from 3 different VMs (is that even possible?)
UPDATE:
I found out that because I'm using the BizSpark program I can't really connect more than one server - and share resources between them (unless I pay extra for it). so this became irrelevant for now
Also, I'm talking about ASP.NET but this shouldn't matter
Azure Files enables you to run multiple IIS instances against a single file share and thus not have to worry about replicating files across the multiple shares - so this is definitely an option. See Getting Started with File Storage for more information.
We are having a VM hosting our web application where its users upload big files to their profiles -mainly they are 3d models- via the Web API of the web app.
What I'm looking to do is to find a way to handle these long running uploading jobs/process efficiently to some place rather than the VM where I'm hosting the application.
I know there are some Azure methods but I want to make it correct. Which is the most efficient way to do that ? Worker Role, a web page running a scripts to upload it to storage or Web Jobs over a queue maybe ?
The function which uploads the file also is having some other processes like generating thumbnails, storing the data to sql and etc.
I would like to fetch window event logs from Azure webrole's instance. when i connect to RDP of instance then by Event viewer i am able to see Window Event Logs of "Application" & "Error" type. Is there any way to directly access that logs using API or something else or i need to use Diagnostic to enable that log data to transfer in to storage and from there i can access?
IF you want to directly access the Azure VM Event logs, the best option is to use use Azure Diagnostics and Azure Cmdlets to access Event Log details. In my understand this one is very easy to setup and once you have access to Event logs, you can download and save it to your local machine. The method is described as below:
http://michaelwasham.com/2011/09/20/windows-event-logs-with-windows-azure-diagnostics-and-powershell/
There is another simple method is that you can create an ASP page and use Event Log API to simply access the event log directly on your web role and customize it the way you would want to see. You can find several examples on net on how to do it i.e. this one. This is a very simple way to get what you are looking for and the only drawback to this approach is that the ASP page will be available on website, unless you find some ways to protect it.
Although you can use any of the above method, setting up Windows Azure Diagnostics to collect Event log from the machine and send to Windows Azure Storage, is best and preferred method. The steps are described here, in case you don't know:
https://msdn.microsoft.com/en-us/library/windows/desktop/bb427443(v=vs.85).aspx
Any other method to collect these logs (using Azure Connect and Remoting etc) would be complex and troublesome.
Should be possible using http://technet.microsoft.com/en-us/library/cc766438.aspx
Although the port will be blocked by default, you will need to change the firewall settings.
See this article for the port numbers (search event log) http://support.microsoft.com/kb/832017/en
I have read the following from Azure in Action book:
"In Windows Azure, the state server, or out-of-process session state provider,
isn’t supported"
Can anyone tell me why this is not supported. They do not explain in the book. I would have thought I could run the state server and all web roles would be able to use this to read session data.
Thanks for replies
Windows Azure has the AppFabric Cache, which is well-suited for session storage. This went live about 2 weeks ago. You can see details in my StackOverflow answers here and here.
I can't give you an absolute answer on the lack of state server, other than the fact that until recently, Web Roles ran under Hosted Web Core instead of Full IIS and that might have had an impact on offering state server. Additionally, since all of your web role instances are equivalent, how would you specify which is the state server? And what happens if Windows Azure recycles that instance? I think this would be a big headache.
With the AppFabric Cache solution, this is cache-as-a-service, completely independent of your role instances, and managed for you. You simply get an endpoint, attach to the cache, and execute puts and gets on name/value pairs. Through the Azure portal, there's a Client Configuration button you click, and a magic chunk of xml gets generated for you - you place that in web.config, and you now have a custom session state provider that stores/retrieves session data to/from cache.
EDIT: On using SQL Azure for session state: SQL Azure doesn't have a SQL Agent, so you wouldn't have a background job periodically clearing the cache. There's an MSDN blog post showing how to get SQL Azure working as a session state provider (and using a worker role background process to perform session cleanup). However, I'd still recommend the AppFabric Cache solution.