C# WCFServiceApplication - 使用本地 IIS 创建虚拟目录失败 - > 无法创建... Web 服务器“http ...”未找到?
Posted
技术标签:
【中文标题】C# WCFServiceApplication - 使用本地 IIS 创建虚拟目录失败 - > 无法创建... Web 服务器“http ...”未找到?【英文标题】:C# WCFServiceApplication - Create Virtual Directory fails by using Local IIS -> Unable to create... Web Server 'http..." not found? 【发布时间】:2020-07-08 23:19:59 【问题描述】:我正在为我的学校制作一个小型 WCFServiceApplication 作为家庭作业。 当我尝试创建一个虚拟目录(从 IISExpress 更改为本地 IIS)时,我得到以下信息 错误:
无法创建虚拟目录。找不到 Web 服务器“http://localhost/WcfServiceApp”。
Error in Detail with Configuration
这是我的 Web.config:
<?xml version="1.0"?>
<configuration>
<appSettings>
<add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
</appSettings>
<system.web>
<compilation debug="true" targetFramework="4.7.2" />
<httpRuntime targetFramework="4.7.2"/>
</system.web>
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior>
<!-- To avoid disclosing metadata information, set the values below to false before deployment -->
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/>
<!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information -->
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
</serviceBehaviors>
</behaviors>
<protocolMapping>
<add binding="basicHttpsBinding" scheme="https" />
</protocolMapping>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
<!--
To browse web app root directory during debugging, set the value below to true.
Set to false before deployment to avoid disclosing web app folder information.
-->
<directoryBrowse enabled="true"/>
</system.webServer>
</configuration>
这里是我的 csproj.user
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<UseIISExpress>true</UseIISExpress>
<Use64BitIISExpress />
<IISExpressSSLPort />
<IISExpressAnonymousAuthentication />
<IISExpressWindowsAuthentication />
<IISExpressUseClassicPipelineMode />
<UseGlobalApplicationHostFile />
<LastActiveSolutionConfig>Debug|Any CPU</LastActiveSolutionConfig>
</PropertyGroup>
<ProjectExtensions>
<VisualStudio>
<FlavorProperties GUID="349c5851-65df-11da-9384-00065b846f21">
<WebProjectProperties>
<StartPageUrl>
</StartPageUrl>
<StartAction>CurrentPage</StartAction>
<AspNetDebugging>True</AspNetDebugging>
<SilverlightDebugging>False</SilverlightDebugging>
<NativeDebugging>False</NativeDebugging>
<SQLDebugging>False</SQLDebugging>
<ExternalProgram>
</ExternalProgram>
<StartExternalURL>
</StartExternalURL>
<StartCmdLineArguments>
</StartCmdLineArguments>
<StartWorkingDirectory>
</StartWorkingDirectory>
<EnableENC>True</EnableENC>
<AlwaysStartWebServerOnDebug>False</AlwaysStartWebServerOnDebug>
</WebProjectProperties>
</FlavorProperties>
</VisualStudio>
</ProjectExtensions>
</Project>
我已尝试删除该行,但仍然失败。
感谢您的帮助!
【问题讨论】:
【参考方案1】:我找到了答案!
在我的 IIS 管理器中缺少 DefaultWebSite。 我只是手动创建的,错误消失了。
教程: Recreate the default website in IIS
【讨论】:
以上是关于C# WCFServiceApplication - 使用本地 IIS 创建虚拟目录失败 - > 无法创建... Web 服务器“http ...”未找到?的主要内容,如果未能解决你的问题,请参考以下文章