EPiServer ServiceApi installation breaks all of our internal API’s

We are on CMS 11 and Commerce 13. I just got the ServiceApi (5.6.1) and ServiceApi.Commerce (5.6.1) installed on our site and with some configuration enabled the site to start without errors. The site wouldn’t start until I added the following line to my web.config.

However, after these steps, our internal system APIs are broken when they worked before. There is a WebApiConfig.cs file that is what sets up our internal APIs but I’m not sure what would fix this. When sending a query off that connects to our API and populates a datatable, these are the errors we get.

GET http://localhost:65238/api/library/list?sEcho=2&iColumns=4&sColumn…ow&bRegex=false&iSortCol_0=0&sSortDir_0=asc&iSortingCols=1&_=1719429175236 500 (Internal Server Error)
Uncaught Error: DataTables warning: table id=DT_MSDSList - Ajax error. For more information about this error, please see http://datatables.net/tn/7
    at Ot (master.min.js:27:2081)
    at Object.error (master.min.js:26:14625)
    at u (master.min.js:3:7199)
    at Object.fireWith [as rejectWith] (master.min.js:3:7948)
    at n (master.min.js:4:11376)
    at XMLHttpRequest.<anonymous> (master.min.js:4:16221)

Another error thrown during trying the QuickOrder, which is API on the site

quickorder.ts:52 

GET http://localhost:65238/api/quickorder/getProductNameAutocomplete?term=d&size=5 500 (Internal Server Error)

WebApiConfig.cs file that is the only place I see anything API related in the entire solution. Opti support said something about there being no XMLMediaTypeFormatter, which was being removed in the WebApiConfig.cs for reasons I’m unaware of by a past partner. Commenting out that line was the last step to get the site to start without an exception.

using System;
using System.Net.Http.Formatting;
using System.Net.Http.Headers;
using System.Web.Http;
using EPiServer.Framework;
using EPiServer.Framework.Initialization;
using Newtonsoft.Json;

namespace CMS.Ellsworth.Business.Initialization
{
[InitializableModule]
[ModuleDependency(typeof(FrameworkInitialization))]
public class WebApiConfig : IInitializableModule
{
    public static string ApiRoute = "api";

    public void Initialize(InitializationEngine context)
    {
        // Enable Web API routing
        GlobalConfiguration.Configure(config =>
        {
            config.MapHttpAttributeRoutes();

            var formatters = GlobalConfiguration.Configuration.Formatters;
            var jsonFormatter = formatters.JsonFormatter;
            var settings = jsonFormatter.SerializerSettings;

            var enumConverter = new Newtonsoft.Json.Converters.StringEnumConverter();
            jsonFormatter.SerializerSettings.Converters.Add(enumConverter);
            config.Formatters.Add(new BrowserJsonFormatter());

            settings.Formatting = Formatting.Indented;

            // Commented out due to it throws System.NullReferenceException: Object reference not set to an instance of an object.
            // If its uncommented, it will throw an exception when the site is started.
            // config.Formatters.Remove(config.Formatters.XmlFormatter);

            config.Routes.MapHttpRoute(
                name: "DefaultEpiApi",
                routeTemplate: ApiRoute + "/{controller}/{id}",
                defaults: new { id = RouteParameter.Optional });
        });
    }

    public void Uninitialize(InitializationEngine context)
    {
    }
}

public class BrowserJsonFormatter : JsonMediaTypeFormatter
{
    public BrowserJsonFormatter()
    {
        SupportedMediaTypes.Add(new MediaTypeHeaderValue("text/html"));
        SerializerSettings.Formatting = Formatting.Indented;
    }

    public override void SetDefaultContentHeaders(Type type, HttpContentHeaders headers, MediaTypeHeaderValue mediaType)
    {
        base.SetDefaultContentHeaders(type, headers, mediaType);
        headers.ContentType = new MediaTypeHeaderValue("application/json");
    }
}

}

Has anyone encountered this or know what to do to get my API’s to work again?

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật