Asp.net +图表一旦部署就不呈现 [英] Asp.net + charts not rendering once deployed

查看:91
本文介绍了Asp.net +图表一旦部署就不呈现的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好;



我被要求为网站整理一些图表,这在开发和预生产环境中都很顺利;然而,当部署到生产中时,我们得到的只是一个巨大的东西



这是web.config内容(除了连接字符串相同) ):

Hello everyone;

I was asked to put together a few graphs for a website, and it all goes smooth on both development and pre-production environments; however, when deployed to production, all we get is a huge nothing.

Here's the web.config content (identical except for connection strings):

<configuration>

  <connectionStrings>
    <add name="GraphData" providerName="System.Data.SqlClient" connectionString="Data Source=prodServer;Initial Catalog=StatsData;User ID=xxxx;Password=xxx;" />
  </connectionStrings>

  <appSettings>
    <!--<add key="ChartImageHandler" value="storage=file; timeout=20; dir=D:\TempChartStuff\; privateImages=false;" />-->
    <add key="ChartImageHandler" value="storage=memory; timeout=20; deleteAfterServicing=true; privateImages=false;" />
  </appSettings>

  <system.webServer>

    <validation validateIntegratedModeConfiguration="false" />

    <handlers>
      <remove name="ChartImageHandler" />
      <add name="ChartImageHandler" preCondition="integratedMode" verb="GET,HEAD,POST"

        path="ChartImg.axd" type="System.Web.UI.DataVisualization.Charting.ChartHttpHandler, System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
    </handlers>
  
  </system.webServer>

  <system.web>
    
    <httpHandlers>
      <add path="ChartImg.axd" verb="GET,HEAD,POST" type="System.Web.UI.DataVisualization.Charting.ChartHttpHandler, System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"

        validate="false" />
    </httpHandlers>
    
    <compilation debug="true" targetFramework="4.5">
      <assemblies>
        <add assembly="System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
      </assemblies>
    </compilation>
    
    <httpRuntime targetFramework="4.5"/>
    
    <pages controlRenderingCompatibilityVersion="3.5" maintainScrollPositionOnPostBack="true">
      <namespaces>
        <add namespace="System.Web.Optimization" />
      </namespaces>
      <controls>
        <add tagPrefix="webopt" namespace="Microsoft.AspNet.Web.Optimization.WebForms" assembly="Microsoft.AspNet.Web.Optimization.WebForms" />
        <add tagPrefix="asp" namespace="System.Web.UI.DataVisualization.Charting"

          assembly="System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
      </controls>
    </pages>
    
    <authentication mode="None" />
    
  </system.web>

</configuration>



我缺少什么?



我尝试了什么:



删除并重新部署所有相关文件。



确保所有数据源实际上都可用(指向两者:开发和预生产环境到产品正确检索数据=正确检索数据=表示图形呈现的环境)



已验证.NET Framework 4.0已安装在生产服务器中。



将ChartImageHandler的存储类型(如上面的代码所示)从File更改为Memeroy,但结果相同,所有内容都在dev和pre-prod中呈现,但不在PROD中。



请注意,在检查网络流量时,目标页面会加载所有资源(每个资源200-OK代码),包括图形图像。我只能猜测它们是空的。

以下是Dev / Pre-Prod和Prod的响应标题:

Dev / Pre -Prod


What am I missing?

What I have tried:

Deleted and re-deployed all related files.

Made sure all data sources are in fact available (pointed both: development and pre-production environments to the production data server, and data is properly being retrieved = graphs are rendered is said environments)

Verified that .NET Framework 4.0 is installed in the production server.

Changed ChartImageHandler's storage type (as seen in above code) from File to Memeroy, but has same result, everything renders in dev and pre-prod, but not in PROD.

Note that when inspecting the network traffic, the target page load all resources(200-OK code on every one) including graph images. I can only guess by the size, that they are empty.
Here are the response headers for Dev/Pre-Prod and Prod respectively:
Dev/Pre-Prod

Cache-Control:	private
Content-Length:	15387
Content-Type:	image/png
Date:		Tue, 12 Jun 2018 17:36:20 GMT
Server:		Microsoft-IIS/8.0
X-AspNet-Version: 4.0.30319
X-Powered-By:	ASP.NET





产品



Prod

Cache-Control:	private
Content-Length:	4866
Content-Type:	image/png
Date:		Tue, 12 Jun 2018 17:38:21 GMT
Server:		Microsoft-IIS/8.5
X-AspNet-Version: 4.0.30319
X-Powered-By:	ASP.NET



欢迎提出每一个建议。在此先感谢!


Each and every suggestion is welcome. Thanks in advance!

推荐答案

按照上述评论。该问题与数据库有关,在这种情况下,生产服务器使用了错误的凭据。

更改测试环境中的数据库连接字符串以指向生产数据库协助进行故障排除,因为它排除了2/3的环境&允许调试,比如使用SQL事件探查器或更改生产字符串指向测试环境有助于确定问题所在位置



亲切的问候
As per above comments. The issue was related to the database, in this case the Production server was using the wrong credentials.
Changing the database connection string in the test environment to point to the production db assists with troubleshooting because it rules out the 2/3 of the environment & allows for debugging, like-wise using SQL Profiler or changing the Production string to point to the test environment helps to identify where the problem is

Kind Regards


这篇关于Asp.net +图表一旦部署就不呈现的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆