Visual Studio中无法将Enable SSL改为False的解决方案求助
WCF服务无法将Enable SSL改回False的解决方案
直接编辑配置文件
找到项目下的Web.config(Web服务)或App.config(自托管服务),手动修改相关配置节点:- 定位到
<bindings>下的对应绑定配置(如<wsHttpBinding>、<basicHttpBinding>),将security节点的mode设为None,同时移除或注释掉transport相关的SSL配置:<bindings> <wsHttpBinding> <binding name="MyServiceBinding"> <security mode="None"> <!-- 注释或删除原有的transport节点 --> <!-- <transport clientCredentialType="None"/> --> </security> </binding> </wsHttpBinding> </bindings> - 找到
<serviceBehaviors>下的<serviceMetadata>节点,设置httpGetEnabled="true"、httpsGetEnabled="false":<serviceBehaviors> <behavior name="MyServiceBehavior"> <serviceMetadata httpGetEnabled="true" httpsGetEnabled="false"/> </behavior> </serviceBehaviors> - 保存配置文件后,执行清理并重建解决方案。
- 定位到
调整项目属性SSL设置(Web项目适用)
右键项目→属性→切换到Web/Debug标签页:- 取消勾选「启用SSL」选项
- 确认项目URL为
http://开头的地址 - 保存设置后重启Visual Studio,再尝试修改并构建。
清理解决方案与缓存
- 点击Visual Studio菜单栏「生成」→「清理解决方案」
- 删除项目目录下的
bin和obj文件夹 - 关闭VS后,删除
%LocalAppData%\Microsoft\VisualStudio\[你的VS版本号]\ComponentModelCache目录下的所有文件 - 重新打开项目,修改Enable SSL为False并构建。
检查IIS Express配置文件
找到项目隐藏的.vs文件夹,进入config\applicationhost.config:- 搜索你的项目名称,找到对应的
<site>节点 - 删除
<bindings>下的https绑定项,只保留http绑定:<site name="MyWcfService" id="3"> <application path="/" applicationPool="Clr4IntegratedAppPool"> <virtualDirectory path="/" physicalPath="C:\MyProjects\MyWcfService"/> </application> <bindings> <binding protocol="http" bindingInformation="*:8080:localhost"/> <!-- 移除这行:<binding protocol="https" bindingInformation="*:44301:localhost"/> --> </bindings> </site> - 保存文件后重启VS,再尝试修改设置。
- 搜索你的项目名称,找到对应的
内容的提问来源于stack exchange,提问作者Anandu G Nath
相关产品推荐
相关产品推荐

