Azure file upload - file-upload

I'm using the standard file upload control on my site hosted with Azure:
<input id="input-file" name="file" type="file" />
I'm uploading to: MySite/images/profiles. Whenever I try to upload I get the following error:
System.IO.DirectoryNotFoundException: Could not find a part of the path
'C:\\DWASFiles\\Sites\\MySite\\VirtualDirectory0\\site\\wwwroot\\images\\profiles\\be0d3d56
-307a-4e3b-a78a-50bac885d760.png'.\r\n at System.IO.__Error.WinIOError(Int32
errorCode, String maybeFullPath)\r\n at System.IO.FileStream.Init(String path,
FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share,
Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath,
Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)\r\n
It is interesting to note, that I have two sites on Azure, this works on the first one I set up, but fails on the second one I set up, they both have the same code, one is for production and the other is for testing.
Any ideas? I thought I might have to setup a storage container, but then I don't understand why it works for the production site. There is a storage container created that matches the name of the production site, but I'm not using any special code to target that, I'm targeting: MySite/images/profiles

Related

I'm trying to set up a new SharePoint production server and getting an error creating an Open XML 2.5 document

I have a SharePoint application written in Visual Basic that works fine and creates Word Documents using Open XML 2.5 on my development machine. We recently set up a new Production server and I published the .wsp file and deployed it on the new server. The application all works fine except the code that generates reports in Word format. It fails on the following line of code.
Dim wpd As WordprocessingDocument = WordprocessingDocument.Create(MemStream, WordprocessingDocumentType.Document, True)
This is what the code looks like in the function that is failing.
''' \<summary\>
'''
''' \</summary\>
''' \<param name="MemStream"\>\</param\>
''' \<returns\>\</returns\>
Public Function WPDCreateFromStream(MemStream As MemoryStream) As WordprocessingDocument
Try
Dim wpd As WordprocessingDocument = WordprocessingDocument.Create(MemStream, WordprocessingDocumentType.Document, True)
Dim MainPart As MainDocumentPart = wpd.AddMainDocumentPart()
MainPart.Document = New Document()
Dim DocBody As New Body()
Return wpd
Catch ex As Exception
WriteErrorToEventLog("OpenXML", "WPDCreateFromStream", "", ex)
Return Nothing
End Try
End Function
Here is the exception detail I get when trying to make the WordProcessingDocument.Create call above.
ERROR: Source: OpenXML Routine: WPDCreateFromStream User:
Message: The type initializer for 'MS.Utility.EventTrace' threw an exception.
StackTrace: at MS.Utility.EventTrace.EasyTraceEvent(Keyword keywords, Event eventID)
at System.IO.Packaging.Package.Open(Stream stream, FileMode packageMode, FileAccess packageAccess, Boolean streaming)
at DocumentFormat.OpenXml.Packaging.OpenXmlPackage.CreateCore(Stream stream)
at DocumentFormat.OpenXml.Packaging.WordprocessingDocument.Create(Stream stream, WordprocessingDocumentType type, Boolean autoSave)
at FIS.SP.PSTARProjectTracker.PSTAR.Core.BusinessLogic.OpenXML.WPDCreateFromStream(MemoryStream MemStream)
Source: WindowsBase
Data: System.Collections.ListDictionaryInternal
InnerException: System.Security.SecurityException: Requested registry access is not allowed.
at System.ThrowHelper.ThrowSecurityException(ExceptionResource resource)
at Microsoft.Win32.RegistryKey.OpenSubKey(String name, Boolean writable)
at Microsoft.Win32.Registry.GetValue(String keyName, String valueName, Object defaultValue)
at MS.Utility.EventTrace.IsClassicETWRegistryEnabled()
at MS.Utility.EventTrace..cctor()
The Zone of the assembly that failed was:
MyComputer
ToString: System.TypeInitializationException: The type initializer for 'MS.Utility.EventTrace' threw an exception. ---> System.Security.SecurityException: Requested registry access is not allowed.
at System.ThrowHelper.ThrowSecurityException(ExceptionResource resource)
at Microsoft.Win32.RegistryKey.OpenSubKey(String name, Boolean writable)
at Microsoft.Win32.Registry.GetValue(String keyName, String valueName, Object defaultValue)
at MS.Utility.EventTrace.IsClassicETWRegistryEnabled()
at MS.Utility.EventTrace..cctor()
--- End of inner exception stack trace ---
at MS.Utility.EventTrace.EasyTraceEvent(Keyword keywords, Event eventID)
at System.IO.Packaging.Package.Open(Stream stream, FileMode packageMode, FileAccess packageAccess, Boolean streaming)
at DocumentFormat.OpenXml.Packaging.OpenXmlPackage.CreateCore(Stream stream)
at DocumentFormat.OpenXml.Packaging.WordprocessingDocument.Create(Stream stream, WordprocessingDocumentType type, Boolean autoSave)
at FIS.SP.PSTARProjectTracker.PSTAR.Core.BusinessLogic.OpenXML.WPDCreateFromStream(MemoryStream MemStream)
TargetSite: Void EasyTraceEvent(Keyword, Event)
I know this is not an issue with the code as the same code works in development. I assume it has to do with permissions, or getting the DocumentFormat.OpenXML.dll installed / registered correctly on the new server, but I've had no luck searching for a solution.
I tried installing OpenXML and the Productivity tool on the server. The productivity tool works and can open a word document, but the Application has the same issue.
If anyone has run into this and can point me to a solution, I would appreciate it.
The MemoryStream is created and passed in to be used by this function. The WordProcessingDocument is returned to the calling function. I could explicitly call ByVal, but in this case it would not change anything.
I am creating a new document, that is why it is coded using WordProcessingDocument.Create
Remember, this code all functions perfectly on the development SharePoint server. It has been used heavily for about a year. I'm just trying to get this to work on a new production server we recently stood up. I have to believe this is related to some permission issue, or a component that is not installed or registered correctly. For Open XML, I believe there is just the one DLL (DocumentFormat.OpenXML.DLL) and it does not register. It is on the server from installing the .wsp package. I also tried installing Open XML 2.5 on the server along with the productivity tool and they all work fine.
The more I think about it, it just feels like a permission issue.

Ravendb database export/import issue in versioning

We are using RavenDB 2.0 and bundle 2330.
We have a problem in export/import of versioned documents. We did the following.
We had a database with versioning bundle enabled
We had a number of records with multiple versions
exported the database to a dump file using Raven-Studio
Tried importing the same in another server with versioning bundle
But the server refused to import the documents and gave error as follows and stopped Import
Server sent:
at Raven.Studio.Infrastructure.InvocationExtensions.Catch(Task
parent, Func2 func) at
Raven.Studio.Infrastructure.InvocationExtensions.Catch(Task parent,
Action1 action) at
Raven.Studio.Commands.ImportDatabaseCommand.<>c_DisplayClass8.b_1()
at System.Threading.Tasks.Task.InnerInvoke() at
System.Threading.Tasks.Task.Execute() at
System.Threading.Tasks.Task.ExecutionContextCallback(Object obj) at
System.Threading.ExecutionContext.Run(ExecutionContext
executionContext, ContextCallback callback, Object state, Boolean
preserveSyncCtx) at
System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task&
currentTaskSlot) at
System.Threading.Tasks.Task.ExecuteEntry(Boolean
bPreventDoubleExecution) at
System.Threading.Tasks.Task.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
at System.Threading.ThreadPoolWorkQueue.Dispatch() at
System.Threading._ThreadPoolWaitCallback.PerformWaitCallback()
Client side exception: System.Net.WebException:
[HttpWebRequest_WebException_RemoteServer] Arguments: NotFound
Debugging resource strings are unavailable. Often the key and
arguments provide sufficient information to diagnose the problem. See
http://go.microsoft.com/fwlink/?linkid=106663&Version=5.1.20513.0&File=System.Windows.dll&Key=HttpWebRequest_WebException_RemoteServer
at System.Net.Browser.ClientHttpWebRequest.EndGetResponse(IAsyncResult
asyncResult) at System.Func2.Invoke(T arg) at
System.Threading.Tasks.TaskFactory1.FromAsyncCoreLogic(IAsyncResult
iar, Func2 endFunction, Action1 endAction, Task`1 promise)
So we removed the versioning bundle and then imported and then applied the versioning bundle.
The import was successful. But all the versions of the documents are being treated as separate documents and not as different version
We are on our alpha stage and suddenly recovering such issues in RavenDB. Any ideas please?
Muthu,
Do Following Steps :
Go to your database where you find list of tables.
click check all to select all the tables.
select export option from dropdown.That will export your tables.
Now create new database where you want all that record
Go inside that database (select database name.)
Go to Import tab.
Now create zip of that exported file. If your server allow simple upload then you can do that also.
Upload that zip/sql exported
your tables are ready to use.
Tell me its working for you or not?

Issue with SQL Server FileStream

We are currently reviewing an issue we have on one of our live environments where OpenFileStream (private method inside SqlFileStream C# class)
System.ComponentModel.Win32Exception (0x80004005): The system cannot find the path specified at System.Data.SqlTypes.SqlFileStream.OpenSqlFileStream(String path, Byte[] transactionContext, FileAccess access, FileOptions options, Int64 allocationSize)at System.Data.SqlTypes.SqlFileStream..ctor(String path, Byte[] transactionContext, FileAccess access, FileOptions options, Int64 allocationSize)at System.Data.SqlTypes.SqlFileStream..ctor(String path, Byte[] transactionContext, FileAccess access)
We have this working on another environment with no issues. The code we are using to call is as follows:
using (SqlCommand command = new SqlCommand(insertFileSql, conn, transaction))
{
string path = null;
byte[] context = null;
using (SqlDataReader reader = command.ExecuteReader())
{
reader.Read();
path = reader.GetString(reader.GetOrdinal("PathName"));
fileID = reader.GetGuid(reader.GetOrdinal("FileId"));
context = (byte[])reader[reader.GetOrdinal("Context")];
}
richTextBox1.AppendText(
string.Format("Path: {0}, FileID:{1}, content: {2}", path, fileID, Convert.ToString(context)));
using (SqlFileStream strm = new SqlFileStream(path, context, FileAccess.ReadWrite))
{
// copy the user file to the Filestream
inputFileStream.CopyTo(strm);
}
We've looked at ports/firewalls and even got to the point of seeing it is NtCreateFile failing inside the .Net Source code (with a value of 3221225530) but I can't find documentation on what that value or the value returned form IOStatusBlock which is one of the return parameters.
\\v02-A60EC2F8-2B24-11DF-9CC3-AF2E56D89593\dbFileStore\dbo\tblFile\DataFile\AC50B769-B6F8-43AA-B266-E4E837D78BA0\VolumeHint-HarddiskDmVolumes\\SQLData
Is there anything anybody else could suggest to look at, me and my team have been looking at this for best part of two days.
Cheers,
J
Though so much time has passed, we with SQL Server 2012 had this problem with ReadWrite. No problem with Read, no problem with Write, but only with ReadWrite.
Looks like something happens during install/uninstall of SQL Server updates - a registry setting gets accidently removed by setup. Readding it with .reg file:
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\LanmanServer\Parameters\FsctlAllowlist]
"FSCTL_SQL_FILESTREAM_FETCH_OLD_CONTENT"=dword:00092560
Worked out that it was Veritas Storage Foundation which wasn't working with SQL FileStream, seems there is a bit of issue with VSF when performing Windows API calls.

HtmlPage.Window.Navigate works in IE but not in Chrome

I have a very simple silverlight interface that has a bunch of links on it. Sort of like an old school html area map where different parts take you to different places on the internal network.
I was testing my pages in IE on a development box and was having success redirecting the page using
HtmlPage.Window.Navigate(New Uri("http://mytestbox02/"))
I took a copy of the source over to my laptop where the default browser for VS2010 happened to be Chrome and to my surprise my links did not work. Sometimes I saw it redirect but it mangled up the uri and it ended up being in the form of mytestbox02/ and therefore it didn't go anywhere but 404 because it was missing the http:// prefix. Sometimes I get an exception. Details of that exception are
System.InvalidOperationException was caught
Message=SetProperty failed.
StackTrace:
at System.Windows.Browser.ScriptObject.SetProperty(String name, Object value)
at System.Windows.Browser.ScriptObject.GetObjectForSafari(IntPtr identity, IntPtr handle, Type type, Boolean releaseReferenceOnDispose)
at System.Windows.Browser.ScriptObject.GetObject(IntPtr handle, Type type, Boolean ownsHandle, Boolean releaseReferenceOnDispose)
at System.Windows.Hosting.ScriptingInterface.GetScriptParamValue(ScriptParam scriptParam)
at System.Windows.Hosting.ScriptingInterface.ConvertFromScriptParamAndDispose(ScriptParam scriptParam)
at System.Windows.Browser.ScriptObject.TryInvoke(String name, Object[] args, Exception& error)
at System.Windows.Browser.ScriptObject.Invoke(String name, Object[] args)
at System.Windows.Browser.HtmlWindow.Navigate(Uri navigateToUri, String target, String targetFeatures)
at System.Windows.Browser.HtmlWindow.Navigate(Uri navigateToUri)
at popupwindow.MainPage.ChildWindow_Closed(Object sender, EventArgs e)
InnerException:
Silverlight 4.1.10111.0 on both the dev box and my laptop.
Any clue what is going on here? I can't be fully sure my clients will use IE so I hope there is a fix for this. Or something more cross-compatible that I can use other than window.navigate? I haven't found anything yet though..
It seems that this may in fact be a Chrome issue - I just spent the day fighting it myself.
http://forums.silverlight.net/t/213769.aspx/1
http://stulic.blogspot.com/2009/08/javascript-locationhref-vs-silverlight.html
You'll probably need to use some kind of javascript.
HtmlPage.Window.Eval("window.location.href = '<something>';");
//or
HtmlPage.Window.Eval("window.location.reload();");

Trouble creating the DNN Survey Module from source code

My boss has asked me to set up DotNetNuke's Survey Module and make a few custom changes to it for a client. But I'm having trouble just getting the bare-bones code to run properly!
Here's what I've done so far:
Downloaded both the source & install folders from
http://dnnsurvey.codeplex.com/releases/view/65186
Created a new VB Web Application Project
Took out all the default pages
Copied the Survey source code into the VB Web Application Project in exactly the same structure
Made a batch script that creates an installation folder identical to DNN's install folder (double-checked by running a folder-diff on it, and all files/folders were identical)
Zipped up my installation folder using 7-zip
The source code compiles perfectly. But even though the files/folders are identical, DNN's zipped package will work properly on my DNN site, and my own zipped package will fail with this famous error message:
Error: Survey is currently unavailable.
DotNetNuke.Services.Exceptions.ModuleLoadException: Could not load type 'DotNetNuke.Modules.Survey.survey'. ---> System.Web.HttpParseException: Could not load type 'DotNetNuke.Modules.Survey.survey'. ---> System.Web.HttpParseException: Could not load type 'DotNetNuke.Modules.Survey.survey'. ---> System.Web.HttpException: Could not load type 'DotNetNuke.Modules.Survey.survey'. at System.Web.UI.TemplateParser.GetType(String typeName, Boolean ignoreCase, Boolean throwOnError) at System.Web.UI.TemplateParser.ProcessInheritsAttribute(String baseTypeName, String codeFileBaseTypeName, String src, Assembly assembly) at System.Web.UI.TemplateParser.PostProcessMainDirectiveAttributes(IDictionary parseData) --- End of inner exception stack trace --- at System.Web.UI.TemplateParser.ProcessException(Exception ex) at System.Web.UI.TemplateParser.ParseStringInternal(String text, Encoding fileEncoding) at System.Web.UI.TemplateParser.ParseString(String text, VirtualPath virtualPath, Encoding fileEncoding) --- End of inner exception stack trace --- at System.Web.UI.TemplateParser.ParseString(String text, VirtualPath virtualPath, Encoding fileEncoding) at System.Web.UI.TemplateParser.ParseFile(String physicalPath, VirtualPath virtualPath) at System.Web.UI.TemplateParser.ParseInternal() at System.Web.UI.TemplateParser.Parse() at System.Web.Compilation.BaseTemplateBuildProvider.get_CodeCompilerType() at System.Web.Compilation.BuildProvider.GetCompilerTypeFromBuildProvider(BuildProvider buildProvider) at System.Web.Compilation.BuildProvidersCompiler.ProcessBuildProviders() at System.Web.Compilation.BuildProvidersCompiler.PerformBuild() at System.Web.Compilation.BuildManager.CompileWebFile(VirtualPath virtualPath) at System.Web.Compilation.BuildManager.GetVPathBuildResultInternal(VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile) at System.Web.Compilation.BuildManager.GetVPathBuildResultWithNoAssert(HttpContext context, VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile) at System.Web.UI.TemplateControl.LoadControl(VirtualPath virtualPath) at DotNetNuke.UI.ControlUtilities.LoadControl[T](TemplateControl containerControl, String ControlSrc) at DotNetNuke.UI.Modules.ModuleHost.LoadModuleControl() --- End of inner exception stack trace ---
I've already asked about this on the DNN forums, but they don't have much to say about it :( So, I thought I'd try StackOverflow as well.
Does anybody have any idea what the problem could be? Thanks very much in advance!
If you want to create package, correctly, you have to first install the module that you have in your dnn instance. Once you are done with that, you did the right job till step4. After step 4 I generally do following:
Go to project properties, and point the bin directory path to parent dnn installation's bin directory
Add reference of dotentnuke.dll and microsoft data acecss application blogs dll
Rebuild the project
Once you can correctly compile the app, you are ready to customize it.
Always use dnn's module create wizard to create package. it is easier and error free way of packaging and delivering the modules.
let me know if you need any other help
I ended up solving this one on my own. These are the steps I took:
Removed all Namespace DotNetNuke.Modules.Survey declaractions
Deleted the ascx, ascx.vb, and designer files for survey, Settings,
and EditSurvey
Created new, empty ones with those names (but used "Survey" instead
of "survey")
Copied/pasted the ascx code into each ascx file (and changed
DotNetNuke.Modules.survey to DotNetNuke.Modules.Survey)
Did a build
Copied/pasted the ascx.vb code into each ascx.vb file (and removed
the Namespace declarations in these files)
Did a build, which was 100% successful this time
Bizarre way to solve the problem, but it worked. :3