Asp.net 在.NET framework SDK样式的web项目中启动浏览器
我们将一些web项目更改为SDK样式,但是如果我们在Visual Studio中启动该项目,它将不会启动浏览器。IISExpress命令提示符确实会运行并启动网站,因此当手动访问网站时,它会工作 使用SDK样式的项目时是否可以启动浏览器?(或者是否有一种解决方法/工具使其成为可能?)。我知道,对于dotnet核心网站来说,这是可行的,并且启动了一个新的浏览器实例,也许我们应该保持.NET framework web项目的旧格式 launchSettings.jsonAsp.net 在.NET framework SDK样式的web项目中启动浏览器,asp.net,.net,Asp.net,.net,我们将一些web项目更改为SDK样式,但是如果我们在Visual Studio中启动该项目,它将不会启动浏览器。IISExpress命令提示符确实会运行并启动网站,因此当手动访问网站时,它会工作 使用SDK样式的项目时是否可以启动浏览器?(或者是否有一种解决方法/工具使其成为可能?)。我知道,对于dotnet核心网站来说,这是可行的,并且启动了一个新的浏览器实例,也许我们应该保持.NET framework web项目的旧格式 launchSettings.json { "iisSettin
{
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:29750/",
"sslPort": 0
}
},
"profiles": {
"IIS Express": {
"commandName": "Executable",
"executablePath": "C:\\Program Files\\IIS Express\\iisexpress.exe",
"commandLineArgs": "/path:\"$(SolutionDir)$(ProjectName)\" /port:29750",
"launchBrowser": true,
"launchUrl": "/"
}
}
}
项目、删除的脚本和少量视图
<Project Sdk="Microsoft.NET.Sdk" ToolsVersion="Current">
<PropertyGroup>
<TargetFramework>net461</TargetFramework>
<AssemblyName>Web</AssemblyName>
<OutputType>Library</OutputType>
<OutputPath>bin\</OutputPath>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Antlr" Version="3.5.0.2" />
<PackageReference Include="Castle.Windsor" Version="3.4.0" />
<PackageReference Include="Castle.Windsor.Mvc" Version="1.3.0" />
<PackageReference Include="Microsoft.AspNet.Mvc" Version="5.2.7" />
<PackageReference Include="Microsoft.AspNet.Web.Optimization" Version="1.1.3" />
<PackageReference Include="Microsoft.CodeDom.Providers.DotNetCompilerPlatform" Version="2.0.1" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.2" />
<PackageReference Include="Owino" Version="1.0.2" />
<PackageReference Include="SignalR.Castle.Windsor" Version="1.0.1" />
<PackageReference Include="Westwind.Globalization" Version="3.0.5" />
</ItemGroup>
<ItemGroup>
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Web" />
</ItemGroup>
<ItemGroup>
<Compile Remove="obj\**" />
<EmbeddedResource Remove="obj\**" />
<EntityDeploy Remove="obj\**" />
<None Remove="node_modules\**" />
<None Remove="fonts\**" />
<None Remove="obj\**" />
<None Remove="Scripts\dist\**" />
<None Remove="package-lock.json" />
<None Include=".babelrc" />
<None Include=".eslintignore" />
<None Include="package.json" />
<None Include="Views\Protocol\Index.cshtml" />
<None Include="Views\Settings\Index.cshtml" />
<None Include="Views\Shared\_Root.cshtml" />
<None Include="Views\Shared\_Shared.cshtml" />
</ItemGroup>
<Import Project="$(VSToolsPath)\WebApplications\Microsoft.WebApplication.targets" Condition="'$(VSToolsPath)' != ''" />
</Project>
net461
网状物
图书馆
垃圾箱\
假的
信息
- Visual Studio 2019(16.4.2)
- .NET framework 4.6.1
- IISExpress启动并运行良好
- 我可以手动访问该网站,但浏览器不会自动打开
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
"applicationUrl": "http://localhost:29750/"
}
导入System.Diagnostics后,可以在启动的底部插入以下示例
Process.Start("chrome.exe", "https://google.com");