Error HRESULT E_FAIL has been returned from a call to a COM component

后端 未结 25 1018
情书的邮戳
情书的邮戳 2020-12-24 05:01

In Silverlight 4 app; what does this error mean?:

\"Error HRESULT E_FAIL has been returned from a call to a COM component.\"

It

相关标签:
25条回答
  • 2020-12-24 05:53

    Here's one way to generate this error, which I stumbled upon today. We have the following button in XAML:

        <Button x:Name="button" Click="Button_Click" Content="Click me" />
    

    The event handler that handles the button's Click event is as follows:

        private void Button_Click(object sender, RoutedEventArgs e)
        {
            button.Margin = new Thickness(0, double.NaN, 0, 0);
        }
    

    When I click on the button I get the aforementioned error. The same error arises if I replace NaN with PositiveInfinity or NegativeInfinity.

    Interestingly, I get a different error message if the first parameter of the Thickness constructor contains the NaN instead of the second.

    0 讨论(0)
  • 2020-12-24 05:53

    Here is what FINALLY fixed this problem for us when trying to use MICROSOFT.TEAMFOUNDATION library when querying Team Foundation Server:

    1. Team Foundation Explorer has to be installed with the currect version that is referenced in the application.
    2. MSDTC – Configuration. (See DTC config below)
    3. IIS App Pool has to run as an account that has query access to the Team Foundation Server
    4. IIS App Pool has to run as an account that has COM access on IIS Server (We have a dedicated server for this so we made the identity user an administer on the local server).
    5. Firewall has to be off or configured to allow COM access for DTC service.

    DTC config ----

    1. Click Start, click Run, type dcomcnfg and then click OK to open Component Services.
    2. In the console tree, click to expand Component Services, click to expand Computers, click to expand My Computer, and click to expand Distributed Transaction Coordinator.
    3. Right click Local DTC, and click Properties to display the Local DTC Properties dialog box.
    4. Click the Security tab.
    5. In the Security Settings section, click Network DTC Access.
    6. In the Client and Administration section, select Allow Remote Clients and Allow Remote Administration.
    7. In the Transaction Manager Communication section, select Allow Inbound and Allow Outbound.
    8. In the Transaction Manager Communication section, select Mutual Authentication Required (if all remote machines are running Windows Server 2003 SP1 or Windows XP SP2 or higher), select Incoming Caller Authentication Required (if running MSDTC in a cluster), or select No Authentication Required if some of the remote machines are pre-Windows Server 2003 SP1 or pre-Windows XP SP2. No Authentication Required is the recommended selection.

    I hope this helps.

    0 讨论(0)
  • 2020-12-24 05:54

    Most of the reason of this problem related dependency propertied on component design. You just face off this problem on design.

    Soulution is easy but takes time :) Clean project and rebuild all. When you enter the desing again you should see everything is fine!

    I hope this helps!

    If you see this exception recently, please try to re-install silverlight sdk4.

    0 讨论(0)
  • 2020-12-24 05:55

    This is a security and permissions issue. Look into the IIS and make sure Integrated Security is ON. Then set Application Protection level to Medium (If it is high then this might be the result). Then check your Web.Config file. Make sure impersonation is off.

    This should help.

    0 讨论(0)
  • 2020-12-24 05:56

    I encountered this same error after installing VS2019 and trying to open a large solution (20+ projects), with both vcxproj and csproj projects, that target VS2015. The csproj all loaded fine, while the vcxproj all failed with the OP's error. Deleting the .vs folder did not work.

    What did work was setting VC++'s "Fallback Location", under the "Browsing Database Fallback" settings.

    Tools (menu)
    -Options...
    --Text Editor
    ---C/C++
    ---Advanced
    ----Browsing Database Fallback
    -----Fallback Location
    

    I set mine to D:\VC++\v16. Where I use v140 for VS2015 and v141 for VS2017. Also set "Always Use" and "Do not warn".

    0 讨论(0)
  • 2020-12-24 05:57

    My problem was a missing Style. I had overridden a control template with a custom brush like so:

    <Style x:Key="MyCustomStyle" TargetType="Thumb">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="Thumb">
                    ....
                    <TextBlock Foreground="{StaticResource MyCustomBrush}"
    

    and was missing my definition of MyCustomBrush, like so:

    <SolidColorBrush x:Key="MyCustomBrush" Color="#FFAC0909"/>
    

    and then BOOM, app didn't startup and I got that COM error message.

    0 讨论(0)
提交回复
热议问题