Accessing file share from Azure Website - asp.net

We have a web application that consists of three main parts:
Web server running ASP.NET 4.5 Web site;
Database server hosting SQL Server 2012;
Another server hosting some Legacy App used by back office;
Relations between parts are as follows:
Web application runs with App Pool Identity set to local user called Foo and consumes database using Entity Framework;
Legacy app consumes database and periodically exports data changes in file system as XML files, folder is shared to local user Foo (local user has the same password as on Web Server) using Windows File Share feature;
Web application monitors file share for new data and imports all the changes if any;
Now we would like to migrate this application to Azure. Unfortunately we have to use VM for SQL Server because our legacy app database uses File Stream feature which is not available on Azure SQL. Also, we need another VM for legacy app.
Currently I have ended up with the following:
Created a new Virtual Network on Azure;
Created a new Azure Website and connected it to VNET using Point-To-Site VPN connection;
Created 2 VM's for SQL Server and legacy app and connected both to VNET, marked network as private network, disabled firewall;
Everything works fine except one thing - Website is unable to access file share located on Legacy App VM. I have tried to enable sharing to Everyone but to no avail.
So, my question: is it possible to access a file share from an Azure website? If not, what alternatives do I have?
I know that we could spin up another VM for Website and then I would have no issues but I would like to use Azure Website to optimize costs and make use of all Azure goodies.

At the time of writing Azure file service SMB shares are only accessible from VMs, Web- and Worker roles. You can use the storage REST.API or client library to access your files from Azure Websites or on-premise. You can get it from nuget.
Install-Package WindowsAzure.Storage
I went through the same exercise of moving a web application that used files to Azure.
Example of what I did.

Related

How to make local IIS use a different Azure Active Directory for access to resources

Here's the situation: I have an account in the azure active directory of my company with several subscriptions. I am building an ASP.NET Framework application for a client. This application is going to be hosted in their own azure environment, so to set this up, they added my email address to their azure active directory. Now in the azure portal I can use the button "change active directory" to either view my company's resources or my client's.
I set up a keyvault in my client's azure environment and I added keyvault as connected service to my application using these instructions. My application is running locally in local IIS, so I set up the application pool to use my user account so it has access to my azure subscriptions.
The issue here is that I still get an error when I try to run the application. The ysod says that azure gives a 401 response when trying to access the keyvault. I see that it's trying to use the guid that is associated with my company's azure active directory (I don't know what the name of this guid is). Obviously, I can't access resources from my client's azure environment with my company's azure active directory.
As an attempt to get more information, I built a small console application and used the same procedure to add keyvault as a connected service, since the internet says that the console application gives more details than the ASP.NET application. However, when I run my console application, I don't get any errors at all and I can access my client's keyvault just fine.
This makes me believe that there is some setting in my user account or IIS that I need to change to make this work, but I can't find what it is.
How can I make my ASP.NET Framework application, running locally in IIS, access a keyvault as connected service in my client's azure environment?
This should work, try to follow this to re-login your user account in VS and make sure you have modified your ASP.NET Framework project.
If it still not work, you could ask your client to create a work account for you in their Azure AD tenant and add it to the keyvault access policy, then use the account to login VS and test.

How to create and deploy a Web Application

I have two working servers (at different locations) with IIS hosting WCF. On each server, WCF (by way of an entity framework) connects to a PostgreSQL database on the same server. My development machine is my laptop.
I have added new stored procedures to the PostgreSQL databases and added these to the WCF implementation on my laptop.
Currently, the Server only has the production site set to use ASP.Net v4.0 application pool.
In Visual Studio 2010 (.Net 4.0), can someone please tell me how to:
Create a Web Deployment Application that will use the existing PostgreSQL database already on the Server (I do not want to export any database from my laptop).
Create a Web Deployment Application that will use the existing PostgreSQL database already on the Server, but target a non-production site like "TestingSite".
Is there anyway of creating a Web Deployment Application that will CREATE the new site, "TestingSite" on the Server with the correct settings.
Ultimately I'm hoping for something really simple that I can develop the WCF code I need on my laptop, then deploy it to the server for testing.

Can a .NET web application be host on dedicated linux server with static IP and run this web app as a web site?

I am working on a project which is a web based in which it has three different modules. For this whole project I am using a dedicated server with static IP which is a linux server with MySQL as a database.
Now my query is, in my project I am using a web and desktop application which connects to my server. Now my web application is integrated with my company website which is done in .NET
Is it possible to host my website in my dedicated server which is a linux version?
Could some one tell me which is the best way to run my whole project in a better way.
Thank you.
You can access a remote MySQL server instance from your .NET application, you need to ensure that any network routing and firewall rules let you through. You must ensure that the application server can reach the MySQL server on the 'listening' port (probably 3306).
Ideally you will have both the database server and application server in close proximity and on the same local network, otherwise there is no problem in this hosting architecture at all. Web applications and databases often require different tuning optimisations and for redundancy purposes it is also good practice to separate them out. Of course, you only have redundancy if you have more than one application server and more than one database server.

Publishing ASP.NET site - No login database?

I have a very simple app on my local machine that uses the ASP.NET membership provider. This works fine on my local machine.
I have published the app to our web server, and I need to know the specifics of setting up the application for asp.net membership to work.
I have a basic understanding that it uses an MDF file and somehow connects to a SQL database (SQLEXPRESS I assume on my local machine) which holds the user/role information.
I keep getting an error that it cannot connect to a SQL database when running the published application on the web server.
I wish to use a SQL server on a different machine (SQL69) than my web server (WEB69)
I have created a new connection string, but how do I tell ASP.NET to use it instead of the "LocalSqlServer" connection string that is created by default?
Can someone explain what is required to me?
Thanks for any help you can offer.
Use the ASP.NET SQL Server Registration Tool without any parameters to set up the SQL Server membership on your local machine. This will also update your config file:
http://msdn.microsoft.com/en-us/library/ms229862%28VS.80%29.aspx
You need to set up SQL Server DB membership on your local machine first. After you have this working, you can simply script the entire DB for your production environment. For this, you can use the Database Publishing Wizard in VS.
You can view a sample config file here:
http://www.codersbarn.com/post/2008/02/24/ASPNET-20-Guest-Book-Admin-Part-II.aspx

asp.net DB: How to handle when publishing on webserver?

Should the ASPNETDB be left in default app folder created by Visual Studio when deploying on webserver? I have another DB that is in the mssql data folder, should that be placed in same directory as well? Im not clear on whether it matters one way or the other.
It depends what environment you are deploying your application to. Specifically, what database servers are available to you or what you are able to deploy.
If you have, or can install, SQL Server and have full administration rights over the instance then the easiest option is to attach both databases to that instance and change your connection strings appropriately. In this case both files should reside outside wwwroot, in a SQL Server specific directory.
I presume this is how the database in your 'mssql' data folder is being accessed. The connection string SHOULD NOT contain 'AttachDbFilename'.
The other option involves SQL Server Express Edition and User Instances. User Instances are created on demand to host a database when the application user does not have the right to attach it to a setup created instance. User Instances run in the context of the application user, ASPNET in your case, and lack advanced security features.
Visual Studio uses this same setup. ASPNETDB is likely using this method. The connection string SHOULD contain 'AttachDbFilename'.
A database that has been created in a user instance can be migrated to a setup instance. However, a database from a setup instance cannot be attached to a user instance because the security information is unavailable.
See Configuring ASP.NET 2.0 Application Services to use SQL Server 2000 or SQL Server 2005 and SQL Server 2005 Express Edition User Instances for further information.

Resources