Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/.net/25.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/reactjs/26.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在Azure应用程序服务中部署带有react的.net核心项目时出现空白页_.net_Reactjs_Azure_Asp.net Core Webapi - Fatal编程技术网

在Azure应用程序服务中部署带有react的.net核心项目时出现空白页

在Azure应用程序服务中部署带有react的.net核心项目时出现空白页,.net,reactjs,azure,asp.net-core-webapi,.net,Reactjs,Azure,Asp.net Core Webapi,我开发了一个WEB api应用程序。问题是,当我在暂存或生产槽azure app services上部署时,会显示一个空白页。我的申请如下: net核心中的Web API项目在前端生成数据消费 这是我的csproj文件: <Project Sdk="Microsoft.NET.Sdk.Web"> <PropertyGroup> <TargetFramework>netcoreapp2.1</TargetFramework> <TypeScr

我开发了一个WEB api应用程序。问题是,当我在暂存或生产槽azure app services上部署时,会显示一个空白页。我的申请如下: net核心中的Web API项目在前端生成数据消费

这是我的csproj文件:

<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>netcoreapp2.1</TargetFramework>
<TypeScriptToolsVersion>Latest</TypeScriptToolsVersion>
<IsPackable>false</IsPackable>
<SpaRoot>Front\</SpaRoot>
<DefaultItemExcludes>$(DefaultItemExcludes);$(SpaRoot)node_modules\** 
</DefaultItemExcludes>
   <UserSecretsId>14b3dfa4-fc53-4655-ba9e-e3589f2c620f</UserSecretsId>
</PropertyGroup>

  <ItemGroup>
<None Include="wwwroot\Document\ProductService.xml" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.App" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.AzureAD.UI" 
Version="2.1.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="2.1.4" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" 
Version="2.1.1" />
<PackageReference Include="React.AspNet" Version="3.4.1" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="3.0.0" />  
</ItemGroup>

<ItemGroup>
<!-- Don't publish the SPA source files, but do show them in the project 
files list -->
<Content Remove="$(SpaRoot)**" />
<None Include="$(SpaRoot)**" Exclude="$(SpaRoot)node_modules\**" />
</ItemGroup>

<Target Name="DebugEnsureNodeEnv" BeforeTargets="Build" Condition=" 
'$(Configuration)' == 'Debug' And !Exists('$(SpaRoot)node_modules') ">
<!-- Ensure Node.js is installed -->
<Exec Command="node --version" ContinueOnError="true">
  <Output TaskParameter="ExitCode" PropertyName="ErrorCode" />
</Exec>
<Error Condition="'$(ErrorCode)' != '0'" Text="Node.js is required to build 
and run this project. To continue, please install Node.js from 
https://nodejs.org/, and then restart your command prompt or IDE." />
<Message Importance="high" Text="Restoring dependencies using 'npm'. This 
may take several minutes..." />
<Exec WorkingDirectory="$(SpaRoot)" Command="npm install" />
</Target>

<Target Name="PublishRunWebpack" AfterTargets="ComputeFilesToPublish">
<!-- As part of publishing, ensure the JS resources are freshly built in 
production mode -->
<Exec WorkingDirectory="$(SpaRoot)" Command="npm install" />
<Exec WorkingDirectory="$(SpaRoot)" Command="npm run build" />

<!-- Include the newly-built files in the publish output -->
    <ItemGroup>
      <DistFiles Include="$(SpaRoot)build\**" />
      <ResolvedFileToPublish Include="@(DistFiles->'%(FullPath)')" 
Exclude="@(ResolvedFileToPublish)">
        <RelativePath>%(DistFiles.Identity)</RelativePath>
        <CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
      </ResolvedFileToPublish>
    </ItemGroup>
  </Target>

  <PropertyGroup Condition="'$(Configuration)' == 'Debug'">
    <TypeScriptTarget>ES5</TypeScriptTarget>
    <TypeScriptJSXEmit>None</TypeScriptJSXEmit>
    <TypeScriptModuleKind />
    <TypeScriptCompileOnSaveEnabled>True</TypeScriptCompileOnSaveEnabled>
    <TypeScriptNoImplicitAny>False</TypeScriptNoImplicitAny>
    <TypeScriptRemoveComments>False</TypeScriptRemoveComments>
    <TypeScriptOutFile />
    <TypeScriptOutDir />
    <TypeScriptGeneratesDeclarations>False</TypeScriptGeneratesDeclarations>
    <TypeScriptNoEmitOnError>True</TypeScriptNoEmitOnError>
    <TypeScriptSourceMap>True</TypeScriptSourceMap>
    <TypeScriptMapRoot />
    <TypeScriptSourceRoot />
  </PropertyGroup>

</Project>

netcoreapp2.1
最新的
假的
正面\
$(默认项目除外)$(SpaRoot)节点_模块\**
14b3dfa4-fc53-4655-ba9e-e3589f2c620f
%(DistFiles.Identity)
保存最新
ES5
没有一个
真的
假的
假的
假的
真的
真的
我的部署有什么问题?为什么我在azure中有一个空白页,而在localhost中没有。我要么在调试中启动,要么在本地主机中npm运行build之后直接启动。它的作品,请帮助,谢谢你


致以最诚挚的问候。

应用程序是如何部署的?是通过VisualStudio吗?动力地狱?CLI?如果可能,请添加有关应用程序部署方式的详细信息。是的,我使用visual studio上的发布屏幕。具有发布模式和运行时目标:可移植。我在几分钟内就创建了github存储库。这里我的repos=>请帮助…我克隆了您的代码,并尝试在本地运行,但在尝试连接到产品数据库时出错。我不确定它是否配置正确。或者出于安全目的,您尚未提交连接详细信息。我也不确定您是如何处理UI页面的路由的。当它在web服务器(如IIS)中运行时,必须完成路由,以便web服务器具有针对给定请求呈现内容的映射。如果你还没有完成,请查看此帖子。