Web services WsOpenServiceHost返回WS_E_OTHER

Web services WsOpenServiceHost返回WS_E_OTHER,web-services,visual-c++,Web Services,Visual C++,我试着在MSDN里跑步。函数WsOpenServiceHost返回错误代码0x803d0021。这个错误意味着 MessageId: WS_E_OTHER Unrecognized error occurred in the Windows Web Services framework. 打印错误: Unable to add URL to HTTP URL group. Unrecognized error occurred in the Windows Web Services fra

我试着在MSDN里跑步。函数WsOpenServiceHost返回错误代码0x803d0021。这个错误意味着

 MessageId: WS_E_OTHER
 Unrecognized error occurred in the Windows Web Services framework.
打印错误:

Unable to add URL to HTTP URL group.
Unrecognized error occurred in the Windows Web Services framework.
The process cannot access the file because it is being used by another process.
如何解决这个问题

int __cdecl wmain(int argc, __in_ecount(argc) wchar_t **argv)
{
    UNREFERENCED_PARAMETER(argc);
    UNREFERENCED_PARAMETER(argv);

    HRESULT hr = NOERROR;
    WS_SERVICE_HOST* host = NULL;
    WS_SERVICE_ENDPOINT serviceEndpoint = {};
    const WS_SERVICE_ENDPOINT* serviceEndpoints[1];
    serviceEndpoints[0] = &serviceEndpoint;

    WS_ERROR* error = NULL;

    WS_SERVICE_ENDPOINT_PROPERTY serviceEndpointProperties[1];
    WS_SERVICE_PROPERTY_CLOSE_CALLBACK closeCallbackProperty = {CloseChannelCallback};
    serviceEndpointProperties[0].id = WS_SERVICE_ENDPOINT_PROPERTY_CLOSE_CHANNEL_CALLBACK;
    serviceEndpointProperties[0].value = &closeCallbackProperty;
    serviceEndpointProperties[0].valueSize = sizeof(closeCallbackProperty);


    // Initialize service endpoint
    serviceEndpoint.address.url.chars = L"http://+:80/example"; // address given as uri
    serviceEndpoint.address.url.length = (ULONG)wcslen(serviceEndpoint.address.url.chars);
    serviceEndpoint.channelBinding = WS_HTTP_CHANNEL_BINDING; // channel binding for the endpoint
    serviceEndpoint.channelType = WS_CHANNEL_TYPE_REPLY; // the channel type
    serviceEndpoint.contract = &calculatorContract;  // the contract
    serviceEndpoint.properties = serviceEndpointProperties;
    serviceEndpoint.propertyCount = WsCountOf(serviceEndpointProperties);

    // Create an error object for storing rich error information
    hr = WsCreateError(
        NULL, 
        0, 
        &error);
    if (FAILED(hr))
    {
        goto Exit;
    }
    // Create Event object for closing the server
    closeServer = CreateEvent(
        NULL, 
        TRUE, 
        FALSE, 
        NULL);
    if (closeServer == NULL)
    {
        hr = HRESULT_FROM_WIN32(GetLastError());
        goto Exit;
    }   
    // Creating a service host
    hr = WsCreateServiceHost(
        serviceEndpoints, 
        1, 
        NULL, 
        0, 
        &host, 
        error);
    if (FAILED(hr))
    {
        goto Exit;
    }
    // WsOpenServiceHost to start the listeners in the service host 
    hr = WsOpenServiceHost(
        host, 
        NULL, 
        error);
    if (FAILED(hr))
    {

        goto Exit;
    }
    WaitForSingleObject(closeServer, INFINITE);
    // Close the service host
    hr = WsCloseServiceHost(host, NULL, error);
    if (FAILED(hr))
    {
        goto Exit;
    }

Exit:
    if (FAILED(hr))
    {
        // Print out the error
        PrintError(hr, error);
    }
    fflush(
        stdout);
    if (host != NULL)
    {
        WsFreeServiceHost(host);
    }


    if (error != NULL)
    {
        WsFreeError(error);
    }
    if (closeServer != NULL)
    {
        CloseHandle(closeServer);
    }
    fflush(stdout);
    return SUCCEEDED(hr) ? 0 : -1;
}

在Windows Web服务框架中,当尝试调试远程目标C++项目时,发生了与此相同的错误。 我已经尝试了所有可能的解决方案,我在互联网上找到了:关闭/卸载antivirusI使用MS Essentials,关闭防火墙,重新安装VS等。 但这没用

所以,我删除了所有程序,而不是上个月安装的windows更新,重新启动计算机,错误就消失了

已卸载的软件:

Foxit幻影PDF标准。Версия: 7.0.5.1021. 宽盖 清洁剂 卸载工具 以防万一,我还卸载了Microsoft Security Essentials,在bug消失后,我再次安装了它,没有任何问题。 希望,这有帮助