Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7869807
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T01:26:11+00:00 2026-06-03T01:26:11+00:00

If a AJAX-Enabled WCF should return an Object with a Date Property which is

  • 0

If a AJAX-Enabled WCF should return an Object with a Date Property which is Nothing a Request to this Service fails.

Test.svc

Imports System.ServiceModel
Imports System.ServiceModel.Activation
Imports System.ServiceModel.Web
Imports System.Runtime.Serialization

<ServiceContract(Namespace:="WebApp")>
<AspNetCompatibilityRequirements(RequirementsMode:=AspNetCompatibilityRequirementsMode.Allowed)>
Public Class Test

   <OperationContract()>
   <WebGet()>
   Public Function TestOperation() As CompositeType
      Dim obj As New CompositeType
      obj.DateProp = Nothing
      obj.StringProp = "Test"
      Return obj
   End Function

End Class

<DataContract()>
Public Class CompositeType
   <DataMember()>
   Public Property DateProp() As Date
   <DataMember()>
   Public Property StringProp() As String

End Class

scripttag on Testform.aspx

<script type="text/javascript">
   $(document).ready(function () {
      $.getJSON('./Test.svc/TestOperation', function (data) {
         alert(data.d.DateProp);
      });
   });
</script>

Web.config (serviceModel section)

<system.serviceModel>
    <behaviors>
        <endpointBehaviors>
            <behavior name="WebApp.TestAspNetAjaxBehavior">
                <enableWebScript />
            </behavior>
        </endpointBehaviors>
    </behaviors>
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
    <services>   
        <service name="WebApp.Test">
        <endpoint address="" behaviorConfiguration="WebApp.TestAspNetAjaxBehavior"
        binding="webHttpBinding" contract="WebApp.Test" />
        </service>
    </services>
</system.serviceModel>

Chrome displays on this call the following error message: “failed to load resource”.

Has anyone an explanation/idea for this behaviour and how are you supposed to prevent this problem?

Thanks for your advice 😉

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T01:26:12+00:00Added an answer on June 3, 2026 at 1:26 am

    If you want to be able to assign Nothing to a DateTime field you should make it nullable:

    <DataMember()>
    Public Property DateProp() As Nullable(Of DateTime)
    

    I am not a VB.NET expert but as far as I know the Date keyword in VB.NET is an alias to the DateTime structure (which is not nullable), except that VB.NET must be doing some black voodoo magic to allow you to assign Nothing to it. Except that when the serializer attempts to serialize it into JSON the following exception is thrown:

    There was an error while trying to serialize parameter
    WebApp:TestOperationResult. The InnerException message was ‘DateTime
    values that are greater than DateTime.MaxValue or smaller than
    DateTime.MinValue when converted to UTC cannot be serialized to
    JSON.’. Please see InnerException for more details.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created an AJAX-enabled WCF service to return a List<> of a custom
I have created an Ajax enabled WCF web service that contains this simple method:
We have a simple ASP.Net WCF Ajax enabled web service which is called via
My AJAX-enabled WCF service returns JSON using this contract, [DataContract] public class JQGridContract {
Can an Ajax-enabled WCF Service pass back a DataTable as a Sys.Data.DataTable? Like this
I have an ajax enabled WCF service method : [OperationContract] public string Test(string name)
I'm using an ajax enabled wcf service with a jquery POST method which gets
I call an ajax enabled wcf service method , <script type=text/javascript> function GetEmployee() {
I created a Ajax enabled WCF service. I can consume the service from javascript
I need help with wcf service. i have a ajax-enabled wcf service: public class

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.