Link to home
Start Free TrialLog in
Avatar of apocalypse910
apocalypse910

asked on

Problem with DataContract on Shared Hosting ASP.net

I am trying to upload an asp.net (VB) application that I've been working on and I've hit a major snag.
The program has been working fine on my test server, however when I upload the program to Godaddy's shared hosting it doesn't work. Several pages work fine however one particularly critical one crashes every time.
---------------------------------------------------------------------------------------------
The error I receive is as follows:

Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

Compiler Error Message: BC30002: Type 'DataContract' is not defined
---------------------------------------------------------------------------------------------
VERSION INFO (Remote Server)
 Microsoft .NET Framework Version:2.0.50727.1434; ASP.NET Version:2.0.50727.1434

VERSION INFO (Local Server)
Microsoft .NET Framework Version:2.0.50727.3053; ASP.NET Version:2.0.50727.3053
---------------------------------------------------------------------------------------------
I think that it may be a version issue but I have no idea how to approach fixing it in a shared hosting environment (and neither did tech support)

I would really appreciate any information you have on how to fix this. I am completely stuck and absolutely frantic about getting this program online. Thanks again for your help!
Imports System.Runtime.Serialization.Json
Imports System.IO
Imports System.Runtime.Serialization
 
 
<DataContract()> Public Class skill_ser          '<---Crashes Here
    <DataMember()> Public i As Integer
    <DataMember()> Public n As String
    <DataMember()> Public p As Integer
    <DataMember()> Public s() As skill_ser
    <DataMember()> Public a() As skill_ser
End Class

Open in new window

Avatar of Heathcliff74
Heathcliff74

I'm not sure how you deployed your code to your live server, but probably you uploaded not only sources, but also compiled binaries. The error states that the remote-server is using version 2.0.50727.1434 of ASP.NET and the local-server is using version 2.0.50727.3053 of ASP.NET. That actually means that the remote-server is using .NET Framework 2.0 SP1 and the local-server is using .NET Framework 2.0 SP2. I'm guessing that local-server is the GoDaddy server and remote-server is you trying to connect to it. I don't think the SP1 / SP2 is the real problem. However, the DataContract class is introduced in .NET Framework 3.0. In .NET 3.0 the binaries for ASP.NET still have the 2.0.x versions. Only the new base-classes from WinFX, like WPF, WCF and WWF have version 3.0.x. Although ASP still uses 2.0.x, it needs framework 3.0.x for the DataContact you use (WCF). My guess is that GoDaddy only has .NET framework 2.0 and not .NET framework 3.x on their servers. You absolutely need a host that provides .NET 3.0 in order to deploy a WCF application.
Avatar of apocalypse910

ASKER

Thank you very much for your response-

To clarify the version information was not part of the error - I added the information for troubleshooting purposes.  The local Server is my Home computer - (I intentionally caused an error to pull the version data) The Remote server information is pulled from the error page on my hosted site.

Sorry I didn't make that more clear- I just reread my post and I couldn't have formatted that any worse.

None of the compiled binaries were uploaded - I uploaded my aspx files and aspx.vb code behinds manually via FTP.

The runtime version selected on the server  ASP 2.0/3.0/3.5 - I assumed this to mean v3.5 with backwards compatibility to 2.0/3.0. For reference I  have the latest version installed on my computer.

I'm not entirely sure where this leaves me..
Thank you very much for taking a look at the problem- sorry for the bad formatting.

.NET 3.5 is indeed downward compatible with 3.0 and 2.0. You have 3.5 installed. But I think GoDaddy only has 2.0 installed. However, you need at least 3.0 to be able to use the DataContract and all other WCF classes. You should first verify the version of the .NET framework installed on the GoDaddy host. It is not neccesarily the same as the ASP.NET version. You can have 3.5 installed and use 2.0 for ASP.NET. Verify that at least 3.0 is installed on GoDaddy. If not, then look for another host that does provide .NET 3.0 or higher. Then it should work.
Hmm.. i've been trying to get a straight answer from GoDaddy on this.. Here is what I found on their site.
________________
Our hosting accounts running IIS 7 are compatible with ASP.NET runtime 3.5, a development framework that supports numerous Web technologies, including Language Integrated Query (LINQ), Windows Presentation Foundation (WPF), Windows Workflow Foundation (WF), Windows Communication Foundation (WC) and Silverlight. For more information, see .NET Framework.
___________________
I've confirmed that I'm running IIS7 so According to their info i'm on V3.5 (Unless i'm misreading) . I wonder if possibly something in my web.config is preventing it from targeting the correct version.

Thanks again for all of your help- I can't tell you how much I appreciate it.
I just spent another 30 minutes on the phone with GoDaddy - They tested that the correct version is installed and functioning.. I also checked my Web.Config and can find nothing that would prevent the correct version from being used.


Also from the detailed compilier output
_______________________________________

Microsoft (R) Visual Basic Compiler version 9.0.21022.8
Copyright (c) Microsoft Corporation.  All rights reserved.

D:\Hosting\3385989\html\sw\Show_Character.aspx.vb(1) : warning BC40056: Namespace or type specified in the Imports 'System.Runtime.Serialization.Json' doesn't contain any public member or cannot be found. Make sure the namespace or the type is defined and contains at least one public member. Make sure the imported element name doesn't use any aliases.

Hmm.. .NET 3.5 is available, but neither System.Runtime.Serialization.DataContract and System.Runtime.Serialization.Json can be found. The only thing I can think of right now is that you are missing references to the assemblies System.ServiceModel.Web.dll and System.Runtime.Serialization.dll in your project-file.
ASKER CERTIFIED SOLUTION
Avatar of Heathcliff74
Heathcliff74

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
     I just put another long call in to GoDaddy. Got a very helpful agent this time - they spent about 30 minutes on the line with the IT department. They haven't found the issue yet but it looks like they are finally taking  a close look at their own server configuration.  The ticket has been escalated so hopefully i'll have an answer soon.

    I can't seem to access anything at all under system.runtime.serialization. They looked into it during my last call but apparently the support agent had the IT department looking for one of my random internal classes rather than the library that was generating the error.

    It is possible that it was purposely disabled as part of the 'medium trust environment' on their shared hosting but I can't think why that would be the case.

   Thanks once again for all of your help - I'm going to go ahead and close the question- but I'll still post any developments in case anyone else hits the same problem.
Ok. Since they acknowledged the problem I'm sure they will sort it out. Good luck with that!
Alright- I spent a week going back and fourth with tech support.

They tried to tell me that the data contract requires SP1- which is false.  Finally after being escalated a few times I was told that those particular classes are not supported. After further inquiries they explained that the classes I required are disabled because the hosting environment is configured as medium trust. I'm not sure what the specific security risk was but it appears that there is nothing I can do on GoDaddy without upgrading to the $50/month or so virtual dedicated server.

After further correspondence they agreed to refund the money I paid for the year of hosting. I found several shared hosting providers at a comparable price with a full-trust setup. I switched to Softsys Hosting and everything worked perfectly (plus I have a 5X higher database size limit- yay!)

Anyways thank you again for all of your help! I would still be combing through my own code trying to figure out what i did wrong if you hadn't pointed me in the right direction.



Hi. Very good to see you got everything sorted out! I think it is not a real security risk, but they probably decided it is too much of a risk (in sense of stability) to combine sites of different users when the functionality is of increasing complexity. And therefore they want some of the functionality to be split up in virtual servers. But they should have been clear about that. They should not say they support .net 3.5 if they do not completely support it. Anyway, good luck with it! Ciao.