WgServerforWindows icon indicating copy to clipboard operation
WgServerforWindows copied to clipboard

The system power state is transitioning from to . when click sharing nic. and choose real nic

Open youxiaojie opened this issue 3 years ago • 8 comments

System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Runtime.InteropServices.COMException (0x8007030E): The system power state is transitioning from to . (0x8007030E) at NETCONLib.INetSharingConfiguration.EnableSharing(tagSHARINGCONNECTIONTYPE Type) at WireGuardServerForWindows.Models.InternetSharingPrerequisite.Resolve(String networkToShare) in C:\Users\micah\source\repos\WireGuardServerForWindows\WireGuardServerForWindows\Models\InternetSharingPrerequisite.cs:line 117 at WireGuardServerForWindows.Models.InternetSharingPrerequisite.Resolve() in C:\Users\micah\source\repos\WireGuardServerForWindows\WireGuardServerForWindows\Models\InternetSharingPrerequisite.cs:line 50 --- End of inner exception stack trace --- at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor, Boolean wrapExceptions) at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters) at GalaSoft.MvvmLight.Helpers.WeakAction.Execute() at GalaSoft.MvvmLight.Command.RelayCommand.Execute(Object parameter) at MS.Internal.Commands.CommandHelpers.CriticalExecuteCommandSource(ICommandSource commandSource, Boolean userInitiated) at System.Windows.Controls.Primitives.ButtonBase.OnClick() at System.Windows.Controls.Button.OnClick() at System.Windows.Controls.Primitives.ButtonBase.OnMouseLeftButtonUp(MouseButtonEventArgs e) at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target) at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised) at System.Windows.UIElement.ReRaiseEventAs(DependencyObject sender, RoutedEventArgs args, RoutedEvent newEvent) at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target) at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised) at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args) at System.Windows.UIElement.RaiseTrustedEvent(RoutedEventArgs args) at System.Windows.Input.InputManager.ProcessStagingArea() at System.Windows.Input.InputProviderSite.ReportInput(InputReport inputReport) at System.Windows.Interop.HwndMouseInputProvider.ReportInput(IntPtr hwnd, InputMode mode, Int32 timestamp, RawMouseActions actions, Int32 x, Int32 y, Int32 wheel) at System.Windows.Interop.HwndMouseInputProvider.FilterMessage(IntPtr hwnd, WindowMessage msg, IntPtr wParam, IntPtr lParam, Boolean& handled) at System.Windows.Interop.HwndSource.InputFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled) at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled) at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o) at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs) at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)

System.Runtime.InteropServices.COMException (0x8007030E): The system power state is transitioning from to . (0x8007030E) at NETCONLib.INetSharingConfiguration.EnableSharing(tagSHARINGCONNECTIONTYPE Type) at WireGuardServerForWindows.Models.InternetSharingPrerequisite.Resolve(String networkToShare) in C:\Users\micah\source\repos\WireGuardServerForWindows\WireGuardServerForWindows\Models\InternetSharingPrerequisite.cs:line 117 at WireGuardServerForWindows.Models.InternetSharingPrerequisite.Resolve() in C:\Users\micah\source\repos\WireGuardServerForWindows\WireGuardServerForWindows\Models\InternetSharingPrerequisite.cs:line 50

youxiaojie avatar Oct 13 '21 17:10 youxiaojie

Hi @youxiaojie. Wow, that is quite the error! There is almost nothing available online that indicates what it could be, so you are in rare company. :-) It doesn't seem to be directly related to WireGuard or even the NIC that we are modifying.

Just on a whim, I've seen some Win32 exceptions when PCs have pending updates or pending restarts (even if Windows doesn't indicate such). Can you make sure your Windows updates are up-to-date and then restart to see if it helps?

Fair warning, due to the limited information available online about this error and the fact that it seems to be coming deep from Windows, I can't promise I'll be much help in diagnosing it.

micahmo avatar Oct 13 '21 21:10 micahmo

let us skip it, I meet a new problem, I run winserver 2012 in vps, now I decide to open ics manually (modify registory open ics in device property), but it told us routing and remote access service is conflict with ics, ok i remove remote access service, stilll not success. image

are you try it in win server?

youxiaojie avatar Oct 14 '21 04:10 youxiaojie

Hi @youxiaojie, I just tested WS4W on Windows Server 2012, and it seems to work fine. However, I am not running in a VPS. They may do some funny tricks related to Internet Sharing.

What I did discover is that WS4W may not correctly detect the registry path for ICS in Server 2012. I had to manually edit HKLM\SYSTEM\ControlSet001\Services\SharedAccess\Parameters\ScopeAddress and set the value to the server address. Then I manually shared the adapter in network settings, and it worked.

Can you try the above steps? If they help you, I can add some better handling for that registry path.

micahmo avatar Oct 14 '21 18:10 micahmo

Yes, I tried, not success, don't know why pop the picture. BTW. the original paper setting HKLM\SYSTEM\CurrentControlSet\Services\SharedAccess\Parameters\ScopeAddress

youxiaojie avatar Oct 15 '21 19:10 youxiaojie

BTW. the original paper setting HKLM\SYSTEM\CurrentControlSet\Services\SharedAccess\Parameters\ScopeAddress

Correct, and that's what the program does as well (see here). I mistakenly thought that key was missing from my Server 2012 registry because the first time I tried to share my adapter, it told me it would be using a different IP than I had specified in the server config Address property.

Can you confirm that if you manually share the adapter, you see the correct address in the prompt? It should be the first one that's valid in the specified Address range.

image

image

micahmo avatar Oct 15 '21 21:10 micahmo

yes.

youxiaojie avatar Oct 17 '21 13:10 youxiaojie

In that case, I am somewhat out of ideas. :-( Just out of curiosity, what VPS do you use? I may consider spinning up a VM and seeing if I can replicate this issue in that environment.

micahmo avatar Oct 18 '21 11:10 micahmo

Hey @youxiaojie, I'm trying to clean up some old issues. Is there anything else I can do to help with this? If you're willing to share your VPS provider, I could sign up for an account and try WS4W myself. Otherwise, I'm not sure what to suggest.

micahmo avatar Dec 27 '21 01:12 micahmo

As this issue has not had any activity in over a year, I am going to close it. Of course, please feel free to reopen at any time.

micahmo avatar Feb 10 '23 19:02 micahmo

i'm getting the same error on a win 2012 vps with the latest release version (2.0.10)

System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Runtime.InteropServices.COMException (0x8007030E): The system power state is transitioning from to . (0x8007030E) at NETCONLib.INetSharingConfiguration.EnableSharing(tagSHARINGCONNECTIONTYPE Type) at WgServerforWindows.Models.InternetSharingPrerequisite.Resolve(String networkToShare) in D:\a\WgServerforWindows\WgServerforWindows\WgServerforWindows\Models\InternetSharingPrerequisite.cs:line 146 at WgServerforWindows.Models.InternetSharingPrerequisite.Resolve() in D:\a\WgServerforWindows\WgServerforWindows\WgServerforWindows\Models\InternetSharingPrerequisite.cs:line 52 --- End of inner exception stack trace --- at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor, Boolean wrapExceptions) at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters) at GalaSoft.MvvmLight.Helpers.WeakAction.Execute() at GalaSoft.MvvmLight.Command.RelayCommand.Execute(Object parameter) at MS.Internal.Commands.CommandHelpers.CriticalExecuteCommandSource(ICommandSource commandSource, Boolean userInitiated) at System.Windows.Controls.Primitives.ButtonBase.OnClick() at System.Windows.Controls.Button.OnClick() at System.Windows.Controls.Primitives.ButtonBase.OnMouseLeftButtonUp(MouseButtonEventArgs e) at System.Windows.UIElement.OnMouseLeftButtonUpThunk(Object sender, MouseButtonEventArgs e) at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target) at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised) at System.Windows.UIElement.ReRaiseEventAs(DependencyObject sender, RoutedEventArgs args, RoutedEvent newEvent) at System.Windows.UIElement.OnMouseUpThunk(Object sender, MouseButtonEventArgs e) at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target) at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised) at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args) at System.Windows.UIElement.RaiseTrustedEvent(RoutedEventArgs args) at System.Windows.Input.InputManager.ProcessStagingArea() at System.Windows.Input.InputProviderSite.ReportInput(InputReport inputReport) at System.Windows.Interop.HwndMouseInputProvider.ReportInput(IntPtr hwnd, InputMode mode, Int32 timestamp, RawMouseActions actions, Int32 x, Int32 y, Int32 wheel) at System.Windows.Interop.HwndMouseInputProvider.FilterMessage(IntPtr hwnd, WindowMessage msg, IntPtr wParam, IntPtr lParam, Boolean& handled) at System.Windows.Interop.HwndSource.InputFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled) at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled) at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o) at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs) at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)

System.Runtime.InteropServices.COMException (0x8007030E): The system power state is transitioning from to . (0x8007030E) at NETCONLib.INetSharingConfiguration.EnableSharing(tagSHARINGCONNECTIONTYPE Type) at WgServerforWindows.Models.InternetSharingPrerequisite.Resolve(String networkToShare) in D:\a\WgServerforWindows\WgServerforWindows\WgServerforWindows\Models\InternetSharingPrerequisite.cs:line 146 at WgServerforWindows.Models.InternetSharingPrerequisite.Resolve() in D:\a\WgServerforWindows\WgServerforWindows\WgServerforWindows\Models\InternetSharingPrerequisite.cs:line 52

a quick search for "at NETCONLib.INetSharingConfiguration.EnableSharing" returned the following solution : https://social.msdn.microsoft.com/Forums/vstudio/en-US/e38d467e-5d0b-4338-8627-b960f3f9a847/systemruntimeinteropservicescomexception-0x80040201-when-setting-internet-connection-sharing?forum=windowsgeneraldevelopmentissues

i'm gonna try the manual solution mentioned in https://github.com/micahmo/WgServerforWindows#inability-to-enable-internet-sharing for now

kamikazem avatar Jun 15 '23 21:06 kamikazem