Windows Server 2012 R2上的.NET 4.0框架问题,但Windows Server 2008上没有. [英] .NET 4.0 framework issue on Windows Server 2012 R2 but not on Windows Server 2008?

查看:788
本文介绍了Windows Server 2012 R2上的.NET 4.0框架问题,但Windows Server 2008上没有.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Silverlight应用程序,该应用程序具有使用.NET Framework 4.0目标的WCF Web服务.   Silverlight应用程序和Web服务位于同一台Web服务器上.

I have a Silverlight application that with WCF web services that use .NET framework 4.0 target.  Silverlight application and web services are on the same web server.

我将应用程序部署到两个不同的Web服务器上:

I deploy the application to two different web servers:

服务器1-Windows Server 2008 Standard SP2

Server 1 - Windows Server 2008 Standard SP2

服务器2-Windows Server 2012 R2数据中心

Server 2 - Windows Server 2012 R2 Datacenter

在服务器1上,我的应用程序和Web服务运行完美,没有错误.  

On server 1 my application and web services run perfectly, no errors.  

在服务器2上,Web服务代码触发错误对象引用未设置为对象实例".我的第一个想法是使用的数据有所不同,因此我确保所使用的数据与以下用户所使用的数据相同 服务器1,仍然是相同的错误.  下一步是从Visual Studio环境中执行代码,并查看错误是否在调试会话中触发,指向相同的数据,但没有错误.

On Server 2 the web services code triggers an error  "Object reference not set to an instance of an object".  My first thought was difference in data being consumed, so I made sure the data used was identical to the data being used by Server 1, still same error.  Next step is to executed code from within my Visual Studio environment and see if the error triggers in my debug session pointing to the same data, but no errors.

下一步是添加临时的调试"程序.可以写入日志文件的代码,这样我就可以准确地看到服务器2上正在发生什么. 查看了我从服务器2上的日志记录结果之后,该错误根本没有任何意义,在那里 不应为未设置为对象实例的对象引用".错误...这是代码示例:

Next step was to add temporary "debug" code that would write to a log file so I could see exactly what is happening on Server 2.  After looking at the results of my logging from Server 2 the error just doesn't make ANY sense at all, there should NOT be an "Object reference not set to an instance of an object" error ... here is the code sample:

        Try

            Dim tProvider As New DC.Database.Tools
            Dim DBCommand As New SqlCommand
            Dim DBAdapter As New SqlDataAdapter

            ' TEMP CODE: remove when done
            Dim tmpLog As New Log
            If Me.DBConnection IsNot Nothing Then
                tmpLog.WriteErrorEventToFile(Me.DBConnection.ConnectionString, 666, "TransactionBalances.Update", "857", "", "")
            End If

            tmpLog.WriteErrorEventToFile(Me.SiteID, 666, "TransactionBalances.Update", "860", "", "")

            If QueryBy_TransactionBalancesID_SiteID(DBCommand, Me.TransactionBalancesID, Me.SiteID) Then

                Dim dtTransactionBalances As New DataTable

                If tProvider.Query(dtTransactionBalances, SQLFormatting.ResultType.Data_Add_Update, Me.DBConnection, DBCommand, DBAdapter) Then

                    If dtTransactionBalances IsNot Nothing Then
                        tmpLog.WriteErrorEventToFile(dtTransactionBalances.Rows.Count.ToString, 666, "TransactionBalances.Update", "869", "", "")
                    End If

                    Select Case dtTransactionBalances.Rows.Count

                        Case 0 ' Add 

                            If Me IsNot Nothing Then
                                tmpLog.WriteErrorEventToFile(Me.TransactionBalancesMAPID.ToString, 666, "TransactionBalances.Update", "877", "", "")
                            End If

                            If DBAdapter IsNot Nothing Then
                                tmpLog.WriteErrorEventToFile(DBAdapter.InsertCommand.ToString, 666, "TransactionBalances.Update", "881", "", "")
                            End If

                            tmpLog.WriteErrorEventToFile(vState.ToString, 666, "TransactionBalances.Update", "884", "", "")

                            Select Case vState
                                Case Info.UpdateState.Normal

                                    If tProvider IsNot Nothing Then
                                        tmpLog.WriteErrorEventToFile(tProvider.DatabaseCommand.ToString, 666, "TransactionBalances.Update", "890", "", "")
                                    Else
                                        tProvider = New DC.Database.Tools
                                    End If

                                    Update = tProvider.Add(dtTransactionBalances, Me, Me.DBConnection, DBAdapter, Me.TransactionBalancesMAPID, , TABLE_NAME, "TransactionBalancesID", Me.TransactionBalancesID)

tmpLog是我的调试代码,用于将日志记录到文本文件.  错误是由上述代码段中的最后一行代码触发的.  

The tmpLog is my debug code that does the logging to text file.  The error is triggered by the the last line of code in the above code segment.  

"Update = tProvider.Add(...)"注:"Update"是方法名称,并且是一个布尔值,在引用之前初始化为False.

"Update = tProvider.Add(..."  Note: "Update" is the method name and is a boolean value, initiated to False prior to reference.

您可以从我的代码中看到,我已经验证了所有其他对象都已实例化.  但是由于某些原因,tProvider不会得到证实?  但这再次仅发生在服务器2上,完全相同的代码在服务器1上可以正常工作.

As you can see form my code I've verified every other object has been instantiated.  But for some reason tProvider will just NOT be substantiated??  But again this ONLY happens on Server 2, the exact same code works fine on Server 1.

我以前从未见过这样的事情.这是Windows Server 2012 R2问题,还是某些.NET 4.0框架与Windows Server 2012 R2不兼容?据我了解,Windows Server 2012 R2随附.NET 4.5框架 操作系统安装...我确实验证了它的安装.我假设其中包括.NET 4.0.

I've never ever seen anything like this before.  Is this a Windows Server 2012 R2 problem, or some .NET 4.0 framework incompatibility with Windows Server 2012 R2?  As I understand it Windows Server 2012 R2 comes with .NET 4.5 framework as part of the OS installation ... I did verify it was installed.  I'm assuming that includes .NET 4.0.

至此,我不知道该如何解决?  还有其他人遇到这个问题吗?

As this point, I'm lost as to how to resolve this?  Anyone else come across this problem?

干杯,罗布.



推荐答案

Robin Ainscough

Hi Robin Ainscough,

谢谢您在这里发布.

对于您的问题,.NET 4.0框架与Windows Server 2012 R2不兼容.

For your question, .NET 4.0 framework incompatibility with Windows Server 2012 R2.

.NET 4.0框架支持:

  • Windows XP SP3
  • Windows Server 2003 SP2
  • Windows Vista SP1或更高版本
  • Windows Server 2008(服务器核心角色不支持)
  • >
  • Windows 7
  • Windows Server 2008 R2(服务器核心角色不支持)

.NET Framework 4.6.1支持:

  • Windows 7 SP1(x86和x64)
  • Windows 8(x86和x64)
  • Windows 8.1(x86和x64)
  • Windows 10
  • Windows Server 2008 R2 SP1(x64)
  • Windows Server 2012(x64)
  • Windows Server 2012 R2(x64)

如果您希望它在Windows Server 2012 R2上运行,则可以安装 .NET Framework 4.6.1 .

If you want it work on Windows server 2012 R2, you could install .NET Framework 4.6.1.

我希望这会对您有所帮助.

I hope this would be helpful to you.

如果还有其他问题,请随时与我们联系.

If you have something else, please feel free to contact us.

最好的问候,

Wendy


这篇关于Windows Server 2012 R2上的.NET 4.0框架问题,但Windows Server 2008上没有.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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