PDF/DOC/XLS Documents won't open after deploying vb.net web app - vb.net

I am relatively new to vb.net, so please bear with me. . .
I created a web app using Visual Studio Professional 2012. When I was coding/testing on my box, everything worked well. Now that I have deployed the project to our server, I am having a problem. While in my application, the user clicks a hyperlink (filename) and I use System.Diagnostics.Process.Start(PDFFile) to open my documents. Before deployment, it would open pdf/doc/xls documents, but after deployment, I receive the following error message:
The system cannot find the drive specified
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.ComponentModel.Win32Exception: The system cannot find the drive specified
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[Win32Exception (0x80004005): The system cannot find the drive specified]
System.Diagnostics.Process.StartWithShellExecuteEx(ProcessStartInfo startInfo) +1075
System.Diagnostics.Process.Start(ProcessStartInfo startInfo) +60
CEI_PerformanceReviews.ScannedReviewReader.Page_Load(Object sender, EventArgs e) +301
System.Web.UI.Control.LoadRecursive() +71
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3178
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.17929
I've tried to rename some of the filenames to see if it didn't like the Network Mapping. That got rid of the error message. I don't really understand the above stack trace - was it telling me that it didn't like the mapping?
After changing the filename, the error seems to have gone away, but now nothing happens. It doesn't appear to be trying to open the document I click on. I've checked on the server that I have deployed to, and it doesn't have Microsoft office installed. Could that be the problem? Again, I'm new to this, so please excuse my lack of understanding.
If anyone could please help me resolve this problem, I would appreciate the help.
Thank you!
Wendy

The stack trace was telling you that it did not understand the path you were providing to the StartWithShellExecute method.
Yes, the issue is most likely that you do not have any software on the server that can handle the PDF/DOC/XLS MIME types.

Related

Global Accessibility For Click Once Installation Path

I have tried with google drive location as a installation path at the time of publishing VSTO application.
But at the time of installation time it throwing an exception to download manifest related stuff.
Exception is like below
Name:
From: https://drive.google.com/drive/folders/1tL4egzEy2uga0asj0bsgzQ10Y8Q-cJ3wj?usp=sharing/MyApp.vsto
************** Exception Text **************
System.Deployment.Application.InvalidDeploymentException: Exception reading manifest from https://drive.google.com/drive/folders/1tL4egzEy2uga0asj0bsgzQ10Y8Q-cJ3wj?usp=sharing/MyApp.vsto: the manifest may not be valid or the file could not be opened. ---> System.Xml.XmlException: DTD is prohibited in this XML document.
at System.Xml.XmlTextReaderImpl.Throw(Exception e)
at System.Xml.XmlTextReaderImpl.ParseDoctypeDecl()
at System.Xml.XmlTextReaderImpl.ParseDocumentContent()
at System.Deployment.Application.ManifestValidatingReader.XmlFilteredReader.Read()
at System.Xml.XsdValidatingReader.Read()
at System.Deployment.Application.ManifestReader.FromDocument(String localPath, ManifestType manifestType, Uri sourceUri)
--- End of inner exception stack trace ---
at Microsoft.VisualStudio.Tools.Applications.Deployment.ClickOnceAddInDeploymentManager.GetManifests(TimeSpan timeout)
at Microsoft.VisualStudio.Tools.Applications.Deployment.ClickOnceAddInDeploymentManager.InstallAddIn()
Any guys having any guess regarding this exception?
Finally my intention is to be available my publish folder at global level, I will send .exe file only to user so that user can be able to install application with the combination of .exe and web location where publish stuff resides.
You have a few questions in this same vein, and while I do not use this feature, I think I see where you're going wrong.
I believe VSTO is assuming you're deploying to your own web server, with no fancy paths. Google Drive clearly has paths that are not meant to handle appending a file or folder name. An FTP server may require login credentials or special connection settings, and is very uncommon these days.
You probably need to stand up a web server, if you don't already have one, and publish to that. Or use a network folder if that works in your situation.

[WebException: The request failed with HTTP status 404: Not Found.]

I am working in two environments, staging and production. In stage, my site pulls up correctly, however, when I publish to production, I receive the following error:
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Net.WebException: The request failed with HTTP status 404: Not Found.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
The back end is Visual Basic.
[NullReferenceException: Object reference not set to an instance of an object.]
Navigation.EstablishContext(HttpRequest Request) +492
Navigation..ctor() +79
[Exception: Error creating Navigation object]
Navigation..ctor() +269
UrlRewriteModule.Application_BeginRequest(Object source, EventArgs e) +262
System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +128
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +1513
Please add your code for a better answer.
You are attempting to access a resource that is not specified in your path, you want to:
check your url,and identify what is not properly formatted,
verify your web.config
verify the permission on the file you are trying to access on production environment.
99% sure, 404 Not Found = resource not properly accessed.

Cassia Library giving exception when calling any methods

I am trying to run the Cassia library on a remote Windows Server 2008 Terminal Server. Any methods I call I get the response below.
No more data is available
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.ComponentModel.Win32Exception: No more data is available
Stack Trace:
[Win32Exception (0x80004005): No more data is available]
Cassia.Impl.NativeMethodsHelper.GetSessionInfos(ITerminalServerHandle server) +159
Cassia.Impl.TerminalServer.GetSessions() +103
I was getting this error as well. Turns out that if there are no sessions for the given server it throws this exception.
Try running qwinsta /server <servername> in a WCP shell. It should return "No session exists for *".
I worked around this by checking exception message for "no more data" and don't throw it if so. It's gross but it's an open source dll.

wcf service getting access denied using dllimport on deployment

I am using a simple wcf service. It works on localhost but when I deploy it to winhost, a shared hosting, I get this error:
The server encountered an error processing the request. The exception message is 'Access is denied.'. See server logs for more details. The exception stack trace is:
at System.ServiceModel.Dispatcher.SyncMethodInvoker.Invoke(Object instance, Object[] inputs, Object[]& outputs) at ....
It actually works fine if I remove a DLLimport function that I use. I am not sure if this is a permission issue or some other errors. My dll is in my bin folder.
Thanks for the help!
I use a sort of reflector tool to read the source code, I think the exception is caused by code access security. I think following link can help you.
http://msdn.microsoft.com/en-us/magazine/cc700337.aspx
You may increase the server permission level to allow the DllImport method.

WCF - weird error

I have my dll hosted at IIS with wsHttpBinding. I have this weird error happened intermediate.
Well, everything will be restored back normal again when I reset the IIS (iisreset).
I also read this one http://msdn.microsoft.com/en-us/library/ee517280.aspx. But I am not sure it has to do with this. Please guide me if you more info on this. Thanks.
Server Error in '/MSBuildCompilation' Application.
Either a required impersonation level was not provided, or the
provided impersonation level is invalid. (Exception from HRESULT:
0x80070542) Description: An unhandled exception occurred during the
execution of the current web request. Please review the stack trace
for more information about the error and where it originated in the
code.
Exception Details: System.Runtime.InteropServices.COMException: Either
a required impersonation level was not provided, or the provided
impersonation level is invalid. (Exception from HRESULT: 0x80070542)
Source Error:
An unhandled exception was generated during the execution of the
current web request. Information regarding the origin and location of
the exception can be identified using the exception stack trace below.
Stack Trace:
[COMException (0x80070542): Either a required impersonation level was
not provided, or the provided impersonation level is invalid.
(Exception from HRESULT: 0x80070542)]
[FileLoadException: Could not load file or assembly
'System.ServiceModel, Version=4.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089' or one of its dependencies. Either a
required impersonation level was not provided, or the provided
impersonation level is invalid. (Exception from HRESULT: 0x80070542)]
System.ServiceModel.Activation.HttpModule.ProcessRequest(Object
sender, EventArgs e) +0
System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
+148 System.Web.HttpApplication.ExecuteStep(IExecutionStep step,
Boolean& completedSynchronously) +75
Looks like you are trying to run the .NET 4.0 Framework in IIS6 which be tricky according to this post. Haven't tried that myself. The exception you are getting is actually happening because your process is unsuccessfully trying to load the System.ServiceModel version 4.0 DLL. Although that post is for ASP.NET, it's applicable to WCF because ASP.NET is the service host process in IIS6. Here is another question along the same lines with some good answers.
(Answered by original poster but in wrong place, moved by me.)
Hi all, I finally solved my own problem by adding this 2 lines at my Client Application code:
WindowsClientCredential wsCred = wsFactory.Credentials.Windows;
wsCred.AllowedImpersonationLevel = TokenImpersonationLevel.Impersonation;
This 2 lines to force client to impersonate every time when it connects.