How to store library's resources in azure -
i'm creating mobile service use nmecab library, need dictionary files referred code using server.mappath
dicdir = httpcontext.current.server.mappath(@"../app_data/ipadic")
when ran service locally work fine when published service on azure system.io.directorynotfoundexception: not find part of path
thrown
i googling , found this topic on so, recommended use localresource
refer local storage think should used in case uploading service not in case.
so, how can store resources in azure?
the localresource area (also known app_data) temporary data. if storing permanent data, should use 1 of azure storage apis handle it. however, temporary data can stored on disk. topic referenced suggested, should use localresource:
localresource localresource = roleenvironment.getlocalresource("downloadedtemplates")
the reason path not work assumes current directory in specific place , hence app_data relative that. not case on mobile services. use localresource instead.
reference localresource example: https://msdn.microsoft.com/en-us/library/azure/microsoft.windowsazure.serviceruntime.roleenvironment.getlocalresource.aspx
Comments
Post a Comment