Quantcast
Channel: Web API
Viewing all articles
Browse latest Browse all 4850

WebApi.HelpPage Error

$
0
0

Hello colleagues! I using nuget package Microsoft.AspNet.WebApi.HelpPage (5.2.3). I was faced with problem.

For example you can use sample:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Runtime.Serialization;
using System.Web.Http;

namespace WebApi.Controllers
{
    [Authorize]
    public class TestController : ApiController
    {
        /// <summary>
        /// TestGet
        /// </summary>
        /// <returns></returns>
        public Plan TestGet()
        {
            var Plan = new Plan();
            Plan.TestObjects = new List<TestClass>();
            return Plan;
        }
    }

    [DataContract(Namespace = "")]
    public class Plan
    {
        /// <summary>
        /// Name
        /// </summary>
        [DataMember]
        public string Name;

        /// <summary>
        /// The list of TestClass.
        /// </summary>
        [DataMember]
        public List<TestClass> TestObjects;
    }

    /// <summary>
    /// TestObject
    /// </summary>
    [DataContract(Namespace = "")]
    public class TestClass
    {
        /// <summary>
        /// identifier
        /// </summary>
        [DataMember]
        public int Id;
    }
}

Description of the problem:
Reload IIS.

If a user clicks on a direct link to the description of the object of collection that he gets an error message.

http://localhost:59576/Help/ResourceModel?modelName=TestClass


If a user is moved to the page with the page the owner of the object or method, then there is no error.

http://localhost:59576/Help/Api/POST-api-Test

The cause of the problem is that in action HelpController.ResourceModel occurs incomplete context initialization.
I have not found ways to resolve this problem.


Viewing all articles
Browse latest Browse all 4850

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>