ASP.NET Core中代码使用X509证书,部署到IIS上后报错:System cannot find the specified file 的解决办法(转载)
问:
I am trying to embrace the mysteries of SSL communication and have found a great tutorial on this site. I was trying to test my own certificate. Using Visual Studio 2012, I simply added an existing file (my certificate in .pfx format) and then changed the "certificate" and "password" settings in app.config. However, when trying to run it, I got an error:
CryptographicException was unhandled: System cannot find the specified file
Then, I tried the same in my Web Service. There I got some more details about the error:
System.Security.Cryptography.CryptographicException: System cannot find specified file. at System.Security.Cryptography.CryptographicException.ThrowCryptogaphicException(Int32 hr)
at System.Security.Cryptography.X509Certificates.X509Utils._QueryCertFileType(String fileName)
at System.Security.Cryptography.X509Certificates.X509Certificate.LoadCertificateFromFile(String fileName, Object password, X509KeyStorageFlags keyStorageFlags)
v System.Security.Cryptography.X509Certificates.X509Certificate2..ctor(String fileName, String password)
v TestServer.DataService.LoadSoap() v c:\Users\Administrator\Documents\Visual Studio 2012\Projects\TestServer\TestServer\DataService.asmx.cs:line 48
I have written this question to the author of the article, but since his last reply was in March 2012, I am not sure, whether he will reply. If somebody could help me with this problem, I would be very grateful.
P.S.: When exporting the certificate from .cer to .pfx, I have changed the title of the file exported. Although I doubt its effect on the problem, I'd rather mention it.
答:
Did you set the following on the application pool in IIS?
- Go to IIS Manager
- Go to the application pool instance
- Click advanced settings
- Under Process model, set Load User Profile to true
See this stack question for further reading: What exactly happens when I set LoadUserProfile of IIS pool?

ASP.NET Core中代码使用X509证书,部署到IIS上后报错:System cannot find the specified file 的解决办法(转载)的更多相关文章
- ASP.NET Core Web 应用程序开发期间部署到IIS自定义主机域名并附加到进程调试
想必大家之前在进行ASP.NET Web 应用程序开发期间都有用到过将我们的网站部署到IIS自定义主机域名并附加到进程进行调试. 那我们的ASP.NET Core Web 应用程序又是如何部署到我们的 ...
- K8S+GitLab-自动化分布式部署ASP.NET Core(三) 更新镜像版本并部署到K8S上
一.介绍 前一篇,介绍了ASP.NET Core部署到K8S上,下面介绍我们在发布新一版本中怎么通过Gitlab CI自动给镜像打版本并部署到K8S上. 二.我们通过GitLab CI/CD 变量 不 ...
- iOS中出现"Check dependenciesWarning: The Copy Bundle Resources build phase contains this target's Info.plist file..."的解决办法A
出现场景 项目中移除info.plist ,后来又重新拖拽回来,同时勾选了Copy items if needed 解决办法 1.删除(删除时选择Remove Reference) 2.重新添加i ...
- asp.net core 错误定位 & vs2017 远程调试部署在centos上的asp.net core程序
前言 程序运行中会出现各种BUG. 排除BUG有三种方式. 一.访问页面直接报错误信息 出于安全,服务器是关闭这个功能的.在centos上可以用 命令设置环境变量来解决: export A ...
- asp.net core 系列 9 三种运行环境和IIS发布
一.在asp.net core中使用多个环境 ASP.NET Core 配置是基于运行时环境, 使用环境变量.ASP.NET Core 在应用启动时读取环境变量ASPNETCORE_ENVIRONME ...
- 在ASP.NET Core中使用百度在线编辑器UEditor
在ASP.NET Core中使用百度在线编辑器UEditor 0x00 起因 最近需要一个在线编辑器,之前听人说过百度的UEditor不错,去官网下了一个.不过服务端只有ASP.NET版的,如果是为了 ...
- [转]在ASP.NET Core中使用百度在线编辑器UEditor
原文地址:https://www.cnblogs.com/durow/p/6116393.html 0x00 起因 最近需要一个在线编辑器,之前听人说过百度的UEditor不错,去官网下了一个.不过服 ...
- Asp.Net Core 中的“虚拟目录”
写在前面 现在部署Asp.Net Core应用已经不再限制于Windows的IIS上,更多的是Docker容器.各种反向代理来部署.也有少部分用IIS部署的,IIS部署确实是又快又简单,图形化操作三下 ...
- asp.net core 中配合响应 html5 的音视频播放流,以及文件下载
一.asp.net core 中配合响应 html5 的音视频播放流,以及文件下载 问题描述: 目前测试了在 Windows(谷歌浏览器).Android(系统浏览器.QQ.微信).iOS 三个系统不 ...
随机推荐
- Ubuntu、deepin 安装 mysql
在 Ubuntu 和 deepin 安装 mysql 是很简单的,只需要几条简单的命令即可 1. sudo apt-get install mysql-server 2. sudo apt-get ...
- Android为TV端助力 SharedPreferences 轻量级存储!
首先在当前进程也就是当前的项目里面进行存储 SharedPreferences.Editor editor = mContext.getSharedPreferences("tvplay&q ...
- css和HTML布局小技巧
一:水平居中 1. 如下所示,让child在parent中水平居中 <!DOCTYPE html> <html> <head lang="en"> ...
- WPF:Hyperlink如何绑定数据
<TextBlock> <Hyperlink> <Run Text="{Binding PCFolderPath, Mode=OneWay}"/> ...
- Orchard详解--第一篇 介绍
Orchard是一个开源的内容管理系统(CMS),它提供了简单的向导式的安装方法,用于快速建站(如WordPress).对于.Net的开发者来说,Orchard有更好的学习价值,所以本系列文章将对Or ...
- HTMLTestRunner修改成Python3版本
修改前:HTMLTestRunner下载地址:http://tungwaiyip.info/software/HTMLTestRunner.html BSTestRunner 下载地址:htt ...
- 最详细的C++对应C#的数据类型转换
C++ ---------------------- C# LDWORD ----------------IntPtr LLONG-------------------Intptr bool ---- ...
- python第一百零七天-- Django 基础 2
1.Django请求的生命周期 路由系统 -> 试图函数(获取模板+数据=>渲染) -> 字符串返回给用户 2.路由系统 /index/ -> 函数或类.as_view() / ...
- Python的变量以及类型
1.程序是用来处理数据的,变量就是用来存储数据的 num1 = 100 2.为了更充分的利用内存空间以及更有效率的管理内存,变量是有不同的类型 3.怎样知道一个变量的类型呢? 3.1 在python ...
- C语言 大小写字母转换
//凯鲁嘎吉 - 博客园 http://www.cnblogs.com/kailugaji/ 方法1: #include<stdio.h> #include<stdlib.h> ...