CardSpaceException: 未发现计算机上安装了任何版本的 CardSpace 服务

CardSpaceException: No version of the CardSpace service was found to be installed on the machine

首先,我不知道我在做什么。我是一名 Java 开发人员,我必须修复别人编写的 C# 程序。

我们必须更新 Web 服务并将其移动到另一台机器。该更新包括对 https 的更改。 我必须修复的工具用于将文件上传到网络服务,并且与服务在同一台机器上运行。 使用 wsdl 文件通过 SOAP(我认为)进行通信。 SSL 证书是自签名的,但存储在受信任的证书存储中。

首先,我尝试只更改新服务器的路径,但上传工具抱怨更改为 https。不幸的是,我没有例外了。

然后我重新导入了新的 wsdl,现在我得到:

System.IdentityModel.Selectors.CardSpaceException: No version of the CardSpace service was found to be installed on the machine. Please install CardSpace and retry the operation.

Server stack trace: at System.IdentityModel.Selectors.CardSpaceShim.GetCardSpaceImplementationDll() at System.IdentityModel.Selectors.CardSpaceShim.InitializeIfNecessary()
at System.IdentityModel.Selectors.CardSpaceSelector.GetToken(CardSpacePolicyElement[] policyChain, SecurityTokenSerializer tokenSerializer) at System.ServiceModel.Description.ClientCredentials.GetInfoCardSecurityToken(Boolean requiresInfoCard, CardSpacePolicyElement[] chain, SecurityTokenSerializer tokenSerializer) at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Object[]& outArgs) at System.Runtime.Remoting.Messaging.StackBuilderSink.AsyncProcessMessage(IMessage msg, IMessageSink replySink)

Exception rethrown at [0]: at System.Runtime.AsyncResult.End[TAsyncResult](IAsyncResult result)
at System.ServiceModel.Channels.ServiceChannel.DisplayInitializationUI() at System.ServiceModel.Channels.ServiceChannel.CallDisplayUIOnce.System.ServiceModel.Channels.ServiceChannel.ICallOnce.Call(ServiceChannel channel, TimeSpan timeout) at System.ServiceModel.Channels.ServiceChannel.CallOnceManager.CallOnce(TimeSpan timeout, CallOnceManager cascade) at System.ServiceModel.Channels.ServiceChannel.EnsureDisplayUI() at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout) at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation) at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)

Exception rethrown at [1]: at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg) at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type) at CLIIkarosImport.ImportUploadService.IImportUploadService.UploadFile(FileUploadMessage request) at CLIIkarosImport.ImportUploadService.ImportUploadServiceClient.CLIIkarosImport.ImportUploadService.IImportUploadService.UploadFile(FileUploadMessage request) in C:\projekte_c#\CLIIkarosImport\CLIIkarosImport\Service References\ImportUploadService\Reference.cs:line 194 at CLIIkarosImport.ImportUploadService.ImportUploadServiceClient.UploadFile(Int64 FileSize, String OriginalFileName, String UserIpV4, String UserIpV6, String UserName, Stream FileStream, String& FileId, String& Message) in C:\projekte_c#\CLIIkarosImport\CLIIkarosImport\Service References\ImportUploadService\Reference.cs:line 205 at CLIIkarosImport.Webservice.Import.ImportServiceModule.<>c__DisplayClass0_0.<.ctor>b__2(Object x) in C:\projekte_c#\CLIIkarosImport\CLIIkarosImport\Webservice\Import\ImportServiceModule.cs:line 86

         Get["/ImportFromPublicLocation/{path}"] = x =>
         {
                string newPath = x.path;
                newPath = newPath.Replace("-*-", ".");
                newPath = newPath.Replace("-#-", @"\");

                var path = Uri.UnescapeDataString(newPath);    
                Console.WriteLine($"Given path is {path}");

                if (!File.Exists(path))
                {
                    Console.WriteLine("File doesn't exist!");
                    return new Response() {StatusCode = HttpStatusCode.NoContent};
                }

                var response = new CustomResponse();

                using (var client = new ImportUploadServiceClient())
                {
                    var fileName = Path.GetFileName(path);
                    var fStream = new FileStream(path, FileMode.Open);

                    string id, message;
                    ServicePointManager.ServerCertificateValidationCallback += (sender, certificate, chain, sslPolicyErrors) => true;
                    try
                    {
                        var fResponse = client.UploadFile(fStream.Length, fileName, "", "", "Import", fStream, out id, out message);
                        Console.WriteLine($"Response is {fResponse}");
                    }
                    catch (Exception e)
                    {
                        Console.WriteLine(e);
                        throw;
                    }
                    
                    response.JobId = id;
                    response.Message = message;
                }

                return new JsonResponse<CustomResponse>(response, defaultJsonSerializer);
            };

我不知道是对 https 的更改还是移动到新服务器的问题。不知道前辈有没有对旧机子做任何改动让它工作。

如果您需要任何进一步的信息,请告诉我。

编辑: 我认为这是应用程序本身的一个问题。如果网络服务器关闭并且我在 wireshark

中找不到对 api-server 的任何调用,我会得到相同的异常

最后,这是使用 STS(AD FS 或 FS-STS)进行用户身份验证的安全问题,我不得不使用服务提供商提供的 DLL 中的 类 来连接到该服务。