Click here to Skip to main content
15,891,136 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi

i have been working on showing a url in windows forms using the webview or webviewcompatible control.i have created a windows forms and have placed the webview control and on navigate method of webview control i am placing the url where i want to navigate..but if i am using the webview control the windows form itself not appearing..when i remove the webview control the form gets loaded..what can be th e issue..can someone suggest

log is as follows:

'WindowsApp1.exe' (CLR v4.0.30319: DefaultDomain): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_32\mscorlib\v4.0_4.0.0.0__b77a5c561934e089\mscorlib.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'WindowsApp1.exe' (CLR v4.0.30319: DefaultDomain): Loaded 'C:\Users\spduvvur\source\repos\WindowsApp1\WindowsApp1\bin\x86\Debug\WindowsApp1.exe'. Symbols loaded.
'WindowsApp1.exe' (CLR v4.0.30319: WindowsApp1.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\Microsoft.VisualBasic\v4.0_10.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualBasic.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'WindowsApp1.exe' (CLR v4.0.30319: WindowsApp1.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System\v4.0_4.0.0.0__b77a5c561934e089\System.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'WindowsApp1.exe' (CLR v4.0.30319: WindowsApp1.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Core\v4.0_4.0.0.0__b77a5c561934e089\System.Core.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'WindowsApp1.exe' (CLR v4.0.30319: WindowsApp1.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Windows.Forms\v4.0_4.0.0.0__b77a5c561934e089\System.Windows.Forms.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'WindowsApp1.exe' (CLR v4.0.30319: WindowsApp1.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Drawing\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Drawing.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'WindowsApp1.exe' (CLR v4.0.30319: WindowsApp1.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Configuration\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Configuration.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'WindowsApp1.exe' (CLR v4.0.30319: WindowsApp1.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Xml\v4.0_4.0.0.0__b77a5c561934e089\System.Xml.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'WindowsApp1.exe' (CLR v4.0.30319: WindowsApp1.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Runtime.Remoting\v4.0_4.0.0.0__b77a5c561934e089\System.Runtime.Remoting.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'WindowsApp1.exe' (CLR v4.0.30319: WindowsApp1.exe): Loaded 'C:\Users\spduvvur\source\repos\WindowsApp1\WindowsApp1\bin\x86\Debug\Microsoft.Toolkit.Forms.UI.Controls.WebView.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'WindowsApp1.exe' (CLR v4.0.30319: WindowsApp1.exe): Loaded 'C:\Windows\system32\WinMetadata\Windows.Foundation.winmd'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'WindowsApp1.exe' (CLR v4.0.30319: WindowsApp1.exe): Loaded 'C:\Windows\system32\WinMetadata\Windows.Web.winmd'. Module was built without symbols.
'WindowsApp1.exe' (CLR v4.0.30319: WindowsApp1.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Runtime\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Runtime.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'WindowsApp1.exe' (CLR v4.0.30319: WindowsApp1.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Runtime.WindowsRuntime\v4.0_4.0.0.0__b77a5c561934e089\System.Runtime.WindowsRuntime.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'WindowsApp1.exe' (CLR v4.0.30319: WindowsApp1.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Runtime.InteropServices.WindowsRuntime\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Runtime.InteropServices.WindowsRuntime.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
The thread 0x55c0 has exited with code 0 (0x0).
The thread 0x53f8 has exited with code 0 (0x0).
An unhandled exception of type 'System.InvalidOperationException' occurred in WindowsApp1.exe
An error occurred creating the form. See Exception.InnerException for details.  The error is: The callee (server [not server application]) is not available and disappeared; all connections are invalid. The call may have executed. (Exception from HRESULT: 0x80010007 (RPC_E_SERVER_DIED))


The thread 0x4a1c has exited with code 0 (0x0).
The thread 0x5640 has exited with code 0 (0x0).
Unhandled Exception: System.InvalidOperationException: An error occurred creating the form. See Exception.InnerException for details.  The error is: The callee (server [not server application]) is not available and disappeared; all connections are invalid. The call may have executed. (Exception from HRESULT: 0x80010007 (RPC_E_SERVER_DIED)) ---> System.Exception: The callee (server [not server application]) is not available and disappeared; all connections are invalid. The call may have executed. (Exception from HRESULT: 0x80010007 (RPC_E_SERVER_DIED))
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT.WebViewControlProcess.<CreateWebViewControlHostAsync>d__16.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.Toolkit.Forms.UI.Controls.WebViewControlProcessExtensions.CreateWebViewControlHost(WebViewControlProcess process, IntPtr hostWindowHandle, Rectangle bounds)
   at Microsoft.Toolkit.Forms.UI.Controls.WebView.Initialize()
   at Microsoft.Toolkit.Forms.UI.Controls.WebView.System.ComponentModel.ISupportInitialize.EndInit()
   at Microsoft.Toolkit.Forms.UI.Controls.WebViewCompatibilityAdapter.Initialize()
   at Microsoft.Toolkit.Forms.UI.Controls.WebViewCompatible..ctor()
   at WindowsApp1.Form1.InitializeComponent() in C:\Users\source\repos\WindowsApp1\WindowsApp1\Form1.Designer.vb:line 26
   at WindowsApp1.Form1..ctor()
   --- End of inner exception stack trace ---
   at WindowsApp1.My.MyProject.MyForms.Create__Instance__[T](T Instance) in :line 190
   at WindowsApp1.My.MyProject.MyForms.get_Form1()
   at WindowsApp1.My.MyApplication.OnCreateMainForm() in C:\Users\source\repos\WindowsApp1\WindowsApp1\My Project\Application.Designer.vb:line 35
   at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun()
   at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel()
   at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine)
   at WindowsApp1.My.MyApplication.Main(String[] Args) in :line 81
The program '[11836] WindowsApp1.exe' has exited with code 0 (0x0).
The program '[11836] WindowsApp1.exe: Program Trace' has exited with code 0 (0x0).


What I have tried:

added reference to Microsoft.Toolkit.Forms.UI.Controls.WebView dll


created a button on windows form and on button click calling as webview.Navigate("www.google.com")
Posted
Updated 6-Apr-20 3:08am
v2
Comments
Richard MacCutchan 6-Apr-20 7:54am    
The details of the problem are in the exception messages.
Vert12 6-Apr-20 7:57am    
Thanks Richard..i have also seen the exception messages but dont know how to proceed further..that is the reason i pasted them here so that somebody can throw some idea
Richard MacCutchan 6-Apr-20 8:04am    
The error is: The callee (server [not server application]) is not available and disappeared; all connections are invalid. The call may have executed. (Exception from HRESULT: 0x80010007 (RPC_E_SERVER_DIED)) ---> System.Exception: The callee (server [not server application]) is not available and disappeared; all connections are invalid. The call may have executed. (Exception from HRESULT: 0x80010007 (RPC_E_SERVER_DIED))

There is a problem with your internet connection, or the server that you are trying to connect to. It's not something that you can fix in your code.

1 solution

Please, read this: Webview control not displaying any page · Issue #32 · windows-toolkit/Microsoft.Toolkit.Win32 · GitHub[^]

rjmurillo commented on 16 Jun 2019:
...
there is a limitation of the web view where it cannot run under admin mode--there is a system process that runs that would enable any code executing within the web view to also run as administrator and have some system level permissions.


and

rjmurillo commented on 17 Jun 2019:
...
The WebBrowser and WebView controls use different engines. Web Browser uses Trident (Internet Explorer) while Web View uses EdgeHTML (Edge). If you open your web page in each of those browsers, you should be able to see the differences as you mention. There is also some documentation about how to debug the web view control using the F12 tools in the documentation.


So, check if you can open links in both browsers (IE and Edge), then run VS in non-admin mode.

For further details, please see: WebView control for Windows Forms and WPF - Windows Community Toolkit | Microsoft Docs[^], especially: Known Issues for WebView control for Windows Forms and WPF - Windows Community Toolkit | Microsoft Docs[^]

MSDN wrote:
WebView browser

  • The WebBrower.ObjectForScripting property and WebView.AddWebAllowedObject(String, Object) are not supported.
  • Instead, use the WebViewControl.InvokeScriptAsync method.
  • You can't programmatically navigate by using a new window.
  • You can't programmatically navigate to a specific frame.
  • You can't programmatically print information from a WebView control.
  • There's no way to programmatically refresh content with cache validation. By default, pages refresh without cache validation by sending a "Pragma:no-cache" header to the server.
 
Share this answer
 
v3
Comments
Vert12 6-Apr-20 12:26pm    
the only mistake i was doing is running as admin..after not running as admin webview control started working
Maciej Los 6-Apr-20 12:45pm    
I'm glad i can help.
If it resolves your issue, please accept my answer (use green button).
Vert12 9-Apr-20 9:30am    
i was able to show my login page in the webview control but on entering credentials and clicking on login the page goes no where its staying there..any suggestions please?
Maciej Los 9-Apr-20 10:00am    
As i mentioned in my answer. There's tons of limitation...
Sorry, but i have no idea what technology is used on your www server.
Vert12 9-Apr-20 10:11am    
thanks for the response..server is in vb.net...alternatively i am trying with webviewcompatible control but only form is loaded without the webviewcompatible control..any suggestion on this please

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900