Answered by:
How do I fix this error for an updater?

Question
-
System.InvalidCastException was unhandled
HResult=-2147467262
Message=Unable to cast object of type 'System.Net.FileWebRequest' to type 'System.Net.HttpWebRequest'.
Source=wapSpice
StackTrace:
at wapSpice.updater.Timer1_Tick(Object sender, EventArgs e) in C:\Users\markm\Documents\Visual Studio 2015\Projects\wapSpice\wapSpice\updater.vb:line 14
at System.Windows.Forms.Timer.OnTick(EventArgs e)
at System.Windows.Forms.Timer.TimerNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun()
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel()
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine)
at wapSpice.My.MyApplication.Main(String[] Args) in :line 81
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException:
MSMATHERJR
Wednesday, March 16, 2016 2:23 AM
Answers
-
Sorry for not updating this, all that it was is that I inserted the destination link wrong
MSMATHERJR
- Marked as answer by PhoenixRage2 Thursday, March 24, 2016 4:24 PM
Thursday, March 24, 2016 4:24 PM
All replies
-
Probably, by rewriting the faulty code. It appears that you are doing some sort of assignment that requires a conversion, and the conversion won't work. One object is based off a 'file://' uri and the other is based off a 'http://' uri, and they are quite different things.
You should show the code you are using and describe why you think you need to do this conversion.
Wednesday, March 16, 2016 4:03 AM -
I fixed the error
MSMATHERJR
- Proposed as answer by DotNet Wang Thursday, March 24, 2016 6:05 AM
Saturday, March 19, 2016 6:44 PM -
Hi PhoenixRage2,
Could you tell us how you fixed it and mark it as answer? Other forum member who encountered similar problems will get help from it.
Best Regards,
Li WangWe are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click HERE to participate the survey.Thursday, March 24, 2016 6:07 AM -
Sorry for not updating this, all that it was is that I inserted the destination link wrong
MSMATHERJR
- Marked as answer by PhoenixRage2 Thursday, March 24, 2016 4:24 PM
Thursday, March 24, 2016 4:24 PM