Cообщество разработчиков на платформе Microsoft >
Форумы
>
AppFabric
>
Import excel file and parse data in windows azure
Import excel file and parse data in windows azure
- Hi,
I want to import excel file through WebRole and parse its data to store in SDS.
My queries are as follows:
1) Can we upload excel file through WebRole and save this file in file system in cloud for further process?
2) Can we use OLEDB driver "Microsoft.Jet.OLEDB.4.0" and "Microsoft.ACE.OLEDB.12.0" because with May CTP release supports full trust?
Thanks
Hemang
Ответы
- Here's one thread from the Windows Azure forum.
http://social.msdn.microsoft.com/Forums/en-US/windowsazure/thread/fd07df3c-e1ea-4cbb-878e-3e2f5dfc45a8- Помечено в качестве ответаYi-Lun LuoMSFT, Модератор7 июля 2009 г. 10:42
- Hello, we do not recommend you to use SDS today. The new RDBMS model (relational data model) will be available in the near future, and the current ACE model will be deprecated. I would suggest you to wait for the RDBMS model of SDS. While I cannot assure you at this time, but the new SDS is likely to be capable of most features the desktop SQL Server. So you may be able to import the data to SDS just like importing data to normal SQL Server.
Anyway, to use local storage, as you already found on http://social.msdn.microsoft.com/Forums/en-US/windowsazure/thread/593c5bc1-6e80-4b31-87d6-113d4cb72ca5/, you just write something like this:
ILocalResource locRes = RoleManager.GetLocalResource("tempStorage");
string rootPath = locRes.RootPath;
Then rootPath will point to a folder in your local storage, and you can use standard .NET I/O methods to work with it.
"tempStorage" is the name of the local storage. You define it in the csdef file:
<WebRole name="WebRole" enableNativeCodeExecution="false">
<InputEndpoints>
<!-- Must use port 80 for http and port 443 for https when running in the cloud -->
<InputEndpoint name="HttpIn" protocol="http" port="80" />
</InputEndpoints>
<LocalStorage name="tempStorage"/>
</WebRole>
But be aware that local storage should only be used to store temporary data that is only used in the current request. The data is only visible to the current instance of the current role. For example, you have two instance of the web role, and the data is stored in instance1's local storage. In this case, instance2 will not be able to access the data, even if it is the same web role. So if the next request from the same client goes to instance2, and you try to get the data from local storage, it will fail. For any data that should be accessable across requests, we recommend you to store it in blob.
Lante, shanaolanxing This posting is provided "AS IS" with no warranties, and confers no rights.- Помечено в качестве ответаYi-Lun LuoMSFT, Модератор7 июля 2009 г. 10:42
Все ответы
I can't answer the Jet question but I will tackle the other one.
You could definately create a web role that allows the file to be uploaded and place it into "localstorage" for that role. Localstorage is your access to the local file system in an Azure hosted application role. However, localstorage is not accessable across roles. So if you wanted the file processed in a seperate process from the web role, you would likely be better off storing it as an Azure storage BLOB, then have a worker role pick that blob up and process it (in memory or copying it to the worker role's localstorage).
- Thanks BrentDACodeMonkey,
Can you more elaborate on how can I store file on LocalStorage in Azure hosted application role?
Could you provide some example or code snippet of how can we store file on localstorage(local file system) in azure.
How can we specify local file system path to save file in azure hosted web role.
- Here's one thread from the Windows Azure forum.
http://social.msdn.microsoft.com/Forums/en-US/windowsazure/thread/fd07df3c-e1ea-4cbb-878e-3e2f5dfc45a8- Помечено в качестве ответаYi-Lun LuoMSFT, Модератор7 июля 2009 г. 10:42
- Hello, we do not recommend you to use SDS today. The new RDBMS model (relational data model) will be available in the near future, and the current ACE model will be deprecated. I would suggest you to wait for the RDBMS model of SDS. While I cannot assure you at this time, but the new SDS is likely to be capable of most features the desktop SQL Server. So you may be able to import the data to SDS just like importing data to normal SQL Server.
Anyway, to use local storage, as you already found on http://social.msdn.microsoft.com/Forums/en-US/windowsazure/thread/593c5bc1-6e80-4b31-87d6-113d4cb72ca5/, you just write something like this:
ILocalResource locRes = RoleManager.GetLocalResource("tempStorage");
string rootPath = locRes.RootPath;
Then rootPath will point to a folder in your local storage, and you can use standard .NET I/O methods to work with it.
"tempStorage" is the name of the local storage. You define it in the csdef file:
<WebRole name="WebRole" enableNativeCodeExecution="false">
<InputEndpoints>
<!-- Must use port 80 for http and port 443 for https when running in the cloud -->
<InputEndpoint name="HttpIn" protocol="http" port="80" />
</InputEndpoints>
<LocalStorage name="tempStorage"/>
</WebRole>
But be aware that local storage should only be used to store temporary data that is only used in the current request. The data is only visible to the current instance of the current role. For example, you have two instance of the web role, and the data is stored in instance1's local storage. In this case, instance2 will not be able to access the data, even if it is the same web role. So if the next request from the same client goes to instance2, and you try to get the data from local storage, it will fail. For any data that should be accessable across requests, we recommend you to store it in blob.
Lante, shanaolanxing This posting is provided "AS IS" with no warranties, and confers no rights.- Помечено в качестве ответаYi-Lun LuoMSFT, Модератор7 июля 2009 г. 10:42
- I have developed the Web Role based application to read the data of Excel 2007 file (xlsx). I have used 'Microsoft.ACE.OLEDB.12.0 ' provider in OLEDB connection to read excel file.
In local development environment, application can reads excel file through OLEDB Connection and parse it data successfully.
When I have deployed same application on Cloud.. I am getting following error:
The 'Microsoft.ACE.OLEDB.12.0' provider is not registered on the local machine.
- This is likely to happen since Excel is not installed on the cloud machines. VSTO solution are very difficult to work in the cloud. However, have you considered to use Open Xml SDK? It should work fine in the cloud.
Lante, shanaolanxing This posting is provided "AS IS" with no warranties, and confers no rights.

