简体   繁体   English

wsdl / soap的问题

[英]Issue with wsdl / soap

I'm using a C# WebApi. 我正在使用C#WebApi。 I have added a Service Reference to a WebService. 我已将服务参考添加到WebService。 The WebService requires a Certificate to be present, which I have included in my project. WebService要求提供一个证书,该证书已包含在我的项目中。

Now the problem is that everything is working as it should when I run it on my local machine. 现在的问题是,当我在本地计算机上运行它时,一切都应正常运行。 However, when I deploy it to live, it won't work. 但是,当我将其部署到生活中时,它将无法工作。 Once I run it on live, the application can't find the .pfx file, which is definitely included in the project and in the right location (Project root). 一旦我实时运行它,应用程序将找不到.pfx文件,该文件肯定包含在项目中以及正确的位置(项目根目录)中。

I've tried HttpContext.Current.Request.MapPath, HttpContext.Current.Server.MapPath, however neither of these seem to work, since it still says it can't find the file specified. 我已经尝试过HttpContext.Current.Request.MapPath,HttpContext.Current.Server.MapPath,但是这两种方法似乎都不起作用,因为它仍然说找不到指定的文件。

I just don't understand how it can work flawless on my local machine, but then it doesn't work on live. 我只是不了解它如何在我的本地计算机上完美运行,但随后却无法正常运行。

Can anyone help me? 谁能帮我? It's driving me nuts. 它让我发疯。

Update: Okay I have found that the PFX file is not the issue. 更新:好的,我发现PFX文件不是问题。 I checked if it could find the file with 'File.Exists' and it can in fact find the file. 我检查了是否可以使用“ File.Exists”找到文件,并且实际上可以找到该文件。 I've found that the error occurs when I try to create a new X509Certificate from the given path 我发现尝试从给定路径创建新的X509证书时发生错误

X509Certificate cert = new X509Certificate(pfxPath, pfxPassword); X509Certificate cert =新的X509Certificate(pfxPath,pfxPassword);

where the pfxPath would be the path to the file which I just confirmed does exist. pfxPath将是我刚刚确认的文件的路径确实存在。

Well, I've figured it out. 好吧,我知道了。 It seems I had to set the 'Load User Profile' option to 'true' in the Application Pool advanced settings for my website. 看来我必须在网站的“应用程序池”高级设置中将“加载用户配置文件”选项设置为“ true”。

It's working as intended now! 现在按预期工作!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM