How to Connect WebServiceURL in Xamarin.Forms project? - c#

Good Day Everyone. I'm creating Xamarin.Forms Portable Application in my Visual Studio 2015.
I want my Mobile Application to connect to the SQL Database I have in my VS2015 and return a LIST OF CUSTOMERS which should be display to my mobile phone.
In my solution, I have created a Xamarin Portable project and a WebForms project that will handle my Web Services and Database.
In my WebForms project, I was able to retrieve data from the Database using LINQ expression. I even checked this by using WEB API and I was really able to retrieved data. Like the image below :
What I want to do is to access this data to my Xamarin Portable project using RestClient. I used the WebServiceUrl of my WebForms project to get the data it contains. But whenever I used a Breakpoint to test if it retrieved the Data, it does not return any value.
Meaning I won't really be able to display the LIST OF CUSTOMERS.
What do you think is the reason behind this?
Here are some of my codes :
1.) WebForms
CustomerController.cs
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.Entity;
using System.Data.Entity.Infrastructure;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
using System.Web.Http.Description;
using WebFormsDemo;
using WebFormsDemo.ViewModel;
namespace WebFormsDemo.Controllers
{
public class CustomerController : ApiController
{
private EBMSEntities db = new EBMSEntities();
// GET: api/Customer
public IQueryable<CustomerViewModel> GetCustomerViewModels()
{
var displaycustomerInfo = from cust in db.CUSTOMERs
select new CustomerViewModel
{
Id = cust.CUSTOMER_ID,
CUSTOMER_CODE = cust.CUSTOMER_CODE,
CUSTOMER_NAME = cust.CUSTOMER_NAME,
CUSTOMER_MOBILE_NUMBER = cust.CUSTOMER_MOBILE_NUMBER,
CUSTOMER_EMAIL_ADDRESS = cust.CUSTOMER_EMAIL_ADDRESS,
CUSTOMER_CONTACT = cust.CUSTOMER_EMAIL_ADDRESS + "," + " " + cust.CUSTOMER_MOBILE_NUMBER
};
return displaycustomerInfo;
}
}
}
2.) XamarinForms
RestClient.cs
public class RestClient_Customer <T>
{
private const string WebServiceUrl = "http://localhost:50857/api/Customer/";
public async Task<List<T>> GetCustomerAsync()
{
var httpClient = new HttpClient();
var json = await httpClient.GetStringAsync(WebServiceUrl);
var taskModels = JsonConvert.DeserializeObject<List<T>>(json);
return taskModels;
}
}
.
CustomerServices.cs
using Plugin.RestClient;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
using XamarinFormsDemo.Models;
namespace XamarinFormsDemo.Services
{
public class CustomerServices
{
public async Task<List<Customer>> GetCustomerAsync()
{
RestClient_Customer<Customer> restClient = new RestClient_Customer<Customer>();
var customerList = await restClient.GetCustomerAsync(); //yung getasync ay pantawag as restclient
return customerList;
}
}
}
.
CustomerVM.cs
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Diagnostics;
using System.Linq;
using System.Net.Http;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Input;
using Xamarin.Forms;
using XamarinFormsDemo.Models;
using XamarinFormsDemo.Services;
using XamarinFormsDemo.Views;
namespace XamarinFormsDemo.ViewModels
{
public class CustomerVM : INotifyPropertyChanged
{
private List<Customer> _customerList; // keep all customers
private List<Customer> _searchedCustomerList; // keep a copy for searching
private Customer _selectedCustomer = new Customer();
private string _keyword = "";
public string Keyword
{
get
{
return _keyword;
}
set
{
this._keyword = value;
// while keyword changed we filter Employees
//Filter();
}
}
private void Filter()
{
if (string.IsNullOrWhiteSpace(_keyword))
{
CustomerList = _searchedCustomerList;
}
else
{
// var lowerKeyword = _keyword.ToLower();
CustomerList = _searchedCustomerList.Where(r => r.CUSTOMER_NAME.ToLower().Contains(_keyword.ToLower())).ToList();
// EmployeesList = _searchedEmployeesList.Where(r => r.EMPLOYEE_NAME.Contains(_keyword)).ToList();
}
}
public List<Customer> CustomerList
{
get
{
return _customerList;
}
set
{
_customerList = value;
OnPropertyChanged();
}
}
public CustomerVM()
{
InitializeDataAsync();
}
private async Task InitializeDataAsync()
{
var customerServices = new CustomerServices();
_searchedCustomerList = await customerServices.GetCustomerAsync();
CustomerList = await customerServices.GetCustomerAsync();
}
public event PropertyChangedEventHandler PropertyChanged;
protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
{
var handler = PropertyChanged;
if (handler != null) handler(this, new PropertyChangedEventArgs(propertyName));
}
}
}
NOTE: Please take a closer look to my RestClient whether I'm doing it right thing or not. Thanks a lot.

I dont think it is the problem with emulator or phone. You cant just connect to localhost over your android device. you must use the external ip address provided by the router if it is connected to Wireless. Please see these 2 topics
How can I access my localhost from my Android device?
How to connect to my http://localhost web server from Android Emulator in Eclipse

Related

Reading Data from stream. Request.Content.ReadAsMultipartAsync(Provider)

I am currently stuck with reading form data. Below is my controller code.
using System.Net;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Threading.Tasks;
using System.Web;
using System.Web.Http;
using Rehub.Models;
using IHostingEnvironment = Microsoft.AspNetCore.Hosting.IHostingEnvironment;
namespace Rehub_v1._0.Areas.Admin.Controllers
{
public class TestController : Controller
{
private IHostingEnvironment Environment;
public TestController()
{
}
[HttpPost]
public async Task<HttpResponseMessage> Post()
{
string path = Path.Combine(this.Environment.WebRootPath, "~/App_Data");
var provider = new MultipartFormDataStreamProvider(path);
await Request.Content.ReadAsMultipartAsync(provider);
var email = new SendGridEmail
{
Dkim = provider.FormData.GetValues("dkim").FirstOrDefault(),
To = provider.FormData.GetValues("to").FirstOrDefault(),
Html = provider.FormData.GetValues("html").FirstOrDefault(),
From = provider.FormData.GetValues("from").FirstOrDefault(),
Text = provider.FormData.GetValues("text").FirstOrDefault(),
SenderIp = provider.FormData.GetValues("sender_ip").FirstOrDefault(),
Envelope = provider.FormData.GetValues("envelope").FirstOrDefault(),
Attachments = int.Parse(provider.FormData.GetValues("attachments").FirstOrDefault()),
Subject = provider.FormData.GetValues("subject").FirstOrDefault(),
Charsets = provider.FormData.GetValues("charsets").FirstOrDefault(),
Spf = provider.FormData.GetValues("spf").FirstOrDefault()
};
// The email is now stored in the email variable
return new HttpResponseMessage(HttpStatusCode.OK);
}
}
}
I get the error on await Request.Content.ReadAsMultipartAsync(provider):
"CS1061 C# ‘HttpRequest’ does not contain a definition for ‘Content’ and no accessible extension method ‘Content’ accepting a first argument of type ‘HttpRequest’ could be found"

How to consume XML/WSDL SOAP in URL using .Net Core 3.1

I'm currently working on a project regarding pushing and pulling data from SAP in .Net Core. I can create web service in SOAMANAGER in SAP and try to access it in Postman API App. I can return a value but I'm having trouble when it comes to .Net Core part. I've followed some guides it does not work.
https://www.infoworld.com/article/3323584/how-to-consume-a-wcf-soap-service-in-aspnet-core.html
https://medium.com/grensesnittet/integrating-with-soap-web-services-in-net-core-adebfad173fb
I am trying yo pull a list of all countries on the SAP as sample
below is my code
HomeController
[HttpGet]
public Task<string[]> Get()
{
CountryName.Z_COUNTRY_TESTING z_COUNTRY_TESTING = new CountryName.Z_COUNTRY_TESTING();
var data = z_COUNTRY_TESTING.IM_COUNTRY.ToString();
return Task.Run(Get);
}
public IActionResult GetCountry()
{
Country country = new Country();
var data = z_COUNTRY_TESTING.IM_COUNTRY.ToString();
country = data;
foreach (var item in country)
{
country.CountryName = item.ToString();
}
return View(country);
}
CountryService.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace WcfServiceTest
{
public class CountryService : ICountryService
{
public List<string> GetCountryName(string name)
{
List<string> listCountries = new List<string>();
listCountries.Contains(name);
return listCountries;
}
}
}
ICountryService.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.ServiceModel;
using System.Text;
using System.Threading.Tasks;
namespace WcfServiceTest
{
[ServiceContract]
public interface ICountryService
{
[OperationContract]
List<string> GetCountryName(string name);
}
}
I hope someone can help me
Thank you.

InvalidOperationException: Unable to resolve service for type while attempting to activate

I am creating ASP.NET CORE project using DI and Repository Pattern. When I run project I get this type of error
InvalidOperationException: Unable to resolve service for type
'AD.BLL.Servisi.IKorisnikServis' while attempting to activate
'AD.Web.Controllers.KorisnikController'.
Here is my interface class
using System;
using System.Collections.Generic;
using System.Text;
namespace AD.BLL.Interfejsi
{
public interface IKorisnik
{
public string VratiKorisnike();
}
}
And here is my Service class which call this interface
using AD.BLL.Interfejsi;
using AD.Web.Data;
using System;
using System.Collections.Generic;
using System.DirectoryServices;
using System.Linq;
using System.Reflection.PortableExecutable;
using System.Text;
namespace AD.BLL.Servisi
{
public class IKorisnikServis : IKorisnik
{
private ApplicationDbContext _db;
public IKorisnikServis(ApplicationDbContext db)
{
_db = db;
}
public string VratiKorisnike()
{
System.DirectoryServices.DirectoryEntry rootDSE = new System.DirectoryServices.DirectoryEntry("LDAP://RootDSE");
var defaultNamingContext = rootDSE.Properties["defaultNamingContext"].Value;
DirectorySearcher dssearch = new DirectorySearcher("LDAP://" + defaultNamingContext);
dssearch.Filter = "(sAMAccountName=ABCDEFGHI)";
SearchResult sresult = dssearch.FindOne();
System.DirectoryServices.DirectoryEntry dsresult = sresult.GetDirectoryEntry();
var Ime = dsresult.Properties["Ime"][0].ToString();
var Prezime = dsresult.Properties["Prezime"][0].ToString();
var LoginName = dsresult.Properties["LoginName"][0].ToString();
var Status = dsresult.Properties["Status"][0].ToString();
var AccountExpired = dsresult.Properties["AccountExpired"][0].ToString();
var PassNevExp = dsresult.Properties["PassNevExp"][0].ToString();
var DomenskaGrupa = dsresult.Properties["DomenskaGrupa"][0].ToString();
var Email = dsresult.Properties["Email"][0].ToString();
return Ime;
}
}
}
Here is my ApplicationDbContext class
using AD.Models.DbModels;
using Microsoft.AspNetCore.Identity.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace AD.Web.Data
{
public class ApplicationDbContext : IdentityDbContext
{
public ApplicationDbContext(DbContextOptions<ApplicationDbContext> options)
: base(options)
{
}
public DbSet<Korisnik> Korisnici { get; set; }
}
}
And here is my Controller action
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using AD.BLL.Servisi;
using Microsoft.AspNetCore.Mvc;
namespace AD.Web.Controllers
{
public class KorisnikController : Controller
{
private IKorisnikServis _korisnikServis;
public KorisnikController(IKorisnikServis korisnikServis)
{
_korisnikServis = korisnikServis;
}
public IActionResult VratiKorisnike()
{
_korisnikServis.VratiKorisnike();
return View();
}
public IActionResult Index()
{
return View();
}
}
}
And in Startup.cs I register IKorisnik and IKorisnikServic
public void ConfigureServices(IServiceCollection services)
{
services.AddControllersWithViews();
services.AddDbContext<ApplicationDbContext>(options =>
options.UseSqlServer(
Configuration.GetConnectionString("DefaultConnection")));
services.AddTransient<IKorisnik, IKorisnikServis>();
}
I checked everything but I cannot see where I made mistake. Any help ?
In your Controller you need to create the filed of type IKorisnik which is your interface instead of IKorisnikServis, So your constructor should be like this:
private IKorisnik _korisnikServis;
public KorisnikController(IKorisnik korisnikServis)
{
_korisnikServis = korisnikServis;
}
However, I would strongly recommend to consider another name for your IKorisnikServis class (KorisnikServis for example) as the prefix I is mostly using to indicate an interface, in this case it is also misleading and I believe that was the reason you have used it in your controller by mistake.

ASP.Net MVC C#: Failed to acquire token silently as no token was found in the cache. Call method AcquireToken

I am attempting to retrieve Azure AD user profile data via the Microsoft Graph API. I have set up a small Visual Studio MVC app using code examples from various sources, primarily Microsoft. In my ignorance, I thought this would be a fairly simple process.
I have browsed other similar cases on SO and have attempted to make use of suggestions from others but to no avail. I have been troubleshooting this issue for four days and would greatly appreciate any assistance.
// UserProfileController.cs
-- contains the calling method: var graphToken = await AuthenticationHelper.GetGraphAccessToken();
//
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Security.Claims;
using System.Web;
using System.Web.Mvc;
using System.Threading.Tasks;
using Microsoft.Graph;
using Microsoft.IdentityModel.Clients.ActiveDirectory;
using Microsoft.Owin.Security;
using Microsoft.Owin.Security.Cookies;
using Microsoft.Owin.Security.OpenIdConnect;
using SSO_Test.Models;
using SSO_Test.Utils;
using System.Net.Http.Headers;
namespace SSO_Test.Controllers
{
[Authorize]
public class UserProfileController : Controller
{
private ApplicationDbContext db = new ApplicationDbContext();
private string clientId = ConfigurationManager.AppSettings["ClientId"];
private string appKey = ConfigurationManager.AppSettings["ClientSecret"];
private string aadInstance = ConfigurationManager.AppSettings["AADInstance"];
private string graphResourceID = "https://graph.microsoft.com";
// GET: UserProfile
public async Task<ActionResult> Index()
{
string tenantID = ClaimsPrincipal.Current.FindFirst("http://schemas.microsoft.com/identity/claims/tenantid").Value;
string userObjectID = ClaimsPrincipal.Current.FindFirst("http://schemas.microsoft.com/identity/claims/objectidentifier").Value;
try
{
var graphToken = await AuthenticationHelper.GetGraphAccessToken();
var authenticationProvider = new DelegateAuthenticationProvider(
(requestMessage) =>
{
requestMessage.Headers.Authorization = new AuthenticationHeaderValue("Bearer", graphToken);
return Task.FromResult(0);
});
var graphClient = new GraphServiceClient(authenticationProvider);
var user = await graphClient.Me.Request().GetAsync();
return View(user);
}
catch (AdalException ex)
{
// Return to error page.
ViewBag.Message = ex.Message;
return View("Error");
}
// if the above failed, the user needs to explicitly re-authenticate for the app to obtain the required token
catch (Exception)
{
return View("Relogin");
}
}
public void RefreshSession()
{
HttpContext.GetOwinContext().Authentication.Challenge(
new AuthenticationProperties { RedirectUri = "/Home" },
OpenIdConnectAuthenticationDefaults.AuthenticationType);
}
}
}
//AuthenticationHelper.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Claims;
using System.Threading.Tasks;
using System.Web;
using Microsoft.IdentityModel.Clients.ActiveDirectory;
using SSO_Test.Models;
namespace SSO_Test.Utils
{
public static class AuthenticationHelper
{
public static async Task<string> GetGraphAccessToken()
{
var signInUserId = ClaimsPrincipal.Current.FindFirst(ClaimTypes.NameIdentifier).Value;
var userObjectId = ClaimsPrincipal.Current.FindFirst(SettingsHelper.ClaimTypeObjectIdentifier).Value;
var clientCredential = new ClientCredential(SettingsHelper.ClientId, SettingsHelper.ClientSecret);
var userIdentifier = new UserIdentifier(userObjectId, UserIdentifierType.UniqueId);
// create auth context
AuthenticationContext authContext = new AuthenticationContext(SettingsHelper.AzureAdAuthority, new ADALTokenCache(signInUserId));
//added check point for verification purposes
System.Diagnostics.Debug.WriteLine("Check point #1");
//GOOD TO THIS POINT
var result = await authContext.AcquireTokenSilentAsync(SettingsHelper.AzureAdGraphResourceURL, clientCredential, userIdentifier);
//ERROR MESSAGE: "Failed to acquire token silently as no token was found in the cache. Call method AcquireToken"
System.Diagnostics.Debug.WriteLine("Check point #2");
//app never reaches the second check point
return result.AccessToken;
}
}
}
//ADALTokenCache.cs
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Data.Entity;
using System.Linq;
using System.Web;
using System.Web.Security;
using Microsoft.IdentityModel.Clients.ActiveDirectory;
namespace SSO_Test.Models
{
public class ADALTokenCache : TokenCache
{
private ApplicationDbContext db = new ApplicationDbContext();
private string userId;
private UserTokenCache Cache;
public ADALTokenCache(string signedInUserId)
{
// associate the cache to the current user of the web app
userId = signedInUserId;
this.BeforeAccess = BeforeAccessNotification;
this.AfterAccess = AfterAccessNotification;
this.BeforeWrite = BeforeWriteNotification;
// look up the entry in the database
Cache = db.UserTokenCacheList.FirstOrDefault(c => c.webUserUniqueId == userId);
// place the entry in memory
this.DeserializeAdalV3((Cache == null) ? null : MachineKey.Unprotect(Cache.cacheBits, "ADALCache"));
}
// clean up the database
public override void Clear()
{
base.Clear();
var cacheEntry = db.UserTokenCacheList.FirstOrDefault(c => c.webUserUniqueId == userId);
db.UserTokenCacheList.Remove(cacheEntry);
db.SaveChanges();
}
// Notification raised before ADAL accesses the cache.
// This is your chance to update the in-memory copy from the DB, if the in-memory version is stale
void BeforeAccessNotification(TokenCacheNotificationArgs args)
{
if (Cache == null)
{
// first time access
Cache = db.UserTokenCacheList.FirstOrDefault(c => c.webUserUniqueId == userId);
}
else
{
// retrieve last write from the DB
var status = from e in db.UserTokenCacheList
where (e.webUserUniqueId == userId)
select new
{
LastWrite = e.LastWrite
};
// if the in-memory copy is older than the persistent copy
if (status.First().LastWrite > Cache.LastWrite)
{
// read from from storage, update in-memory copy
Cache = db.UserTokenCacheList.FirstOrDefault(c => c.webUserUniqueId == userId);
}
}
this.DeserializeAdalV3((Cache == null) ? null : MachineKey.Unprotect(Cache.cacheBits, "ADALCache"));
}
// Notification raised after ADAL accessed the cache.
// If the HasStateChanged flag is set, ADAL changed the content of the cache
void AfterAccessNotification(TokenCacheNotificationArgs args)
{
// if state changed
if (this.HasStateChanged)
{
Cache = new UserTokenCache
{
webUserUniqueId = userId,
//cacheBits = MachineKey.Protect(this.Serialize(), "ADALCache"),
cacheBits = MachineKey.Protect(this.SerializeAdalV3(), "ADALCache"),
LastWrite = DateTime.Now
};
// update the DB and the lastwrite
db.Entry(Cache).State = Cache.UserTokenCacheId == 0 ? EntityState.Added : EntityState.Modified;
db.SaveChanges();
this.HasStateChanged = false;
}
}
void BeforeWriteNotification(TokenCacheNotificationArgs args)
{
// if you want to ensure that no concurrent write take place, use this notification to place a lock on the entry
}
public override void DeleteItem(TokenCacheItem item)
{
base.DeleteItem(item);
}
}
}
//ApplicationDbContext.cs
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Data.Entity;
using System.Linq;
using System.Web;
namespace SSO_Test.Models
{
public class ApplicationDbContext : DbContext
{
public ApplicationDbContext()
: base("DefaultConnection")
{
}
public DbSet<UserTokenCache> UserTokenCacheList { get; set; }
}
public class UserTokenCache
{
[Key]
public int UserTokenCacheId { get; set; }
public string webUserUniqueId { get; set; }
public byte[] cacheBits { get; set; }
public DateTime LastWrite { get; set; }
}
}
As you can see, I have noted in the GetGraphAccessToken() method the error message:
"Failed to acquire token silently as no token was found in the cache.
Call method AcquireToken".
I was able to isolate the AcquireTokenSilentAsync() method as the culprit by bracketing it with a pair of Debug.Writeline statements, the first which ran successfully and the second which did not. This was verified by reviewing the contents of the VS Output window, as follows:
Check point #1
Exception thrown:
'Microsoft.IdentityModel.Clients.ActiveDirectory.AdalSilentTokenAcquisitionException'
in mscorlib.dll
The program '[13980] iisexpress.exe' has exited with code -1
(0xffffffff).
I really want this thing to work and I would much prefer utilizing the Graph SDK approach as opposed to using a REST API.
Again, I have been banging my head against the wall for four-plus days. My head is okay but the wall is in bad shape.
Thanks in advance.
If AcquireTokenSilent fails, it means that there is no token in the cache so you have to go get one via AcquireToken as in this.
You've tagged the question with "B2C" but is looks like you are using Azure AD?
There are a full set of Authentication Providers for the standard set of OAuth flows that are now available so you don't have to use the DelegatedAuthenticationProvider any more. https://github.com/microsoftgraph/msgraph-sdk-dotnet-auth There are docs about how to chose the right Auth provider based on scenario here https://learn.microsoft.com/en-us/graph/sdks/choose-authentication-providers?tabs=CS

WebApi Route returns Not Found in Orchard Module

I am creating an Orchard module where i want to add a WebApi controller.
My Module.txt:
Name: ModuleName
AntiForgery: enabled
Author: The Orchard Team
Website: http://orchardproject.net
Version: 1.0
OrchardVersion: 1.0
Description: Description for the module
Features:
ModuleName:
Description: Description for feature ModuleName.
I have added an ApiRoutes class:
using Orchard.Mvc.Routes;
using Orchard.WebApi.Routes;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Http;
namespace ModuleName
{
public class ModuleNameApiRoutes : IHttpRouteProvider
{
public void GetRoutes(ICollection<RouteDescriptor> routes)
{
foreach (var routeDescriptor in GetRoutes())
{
routes.Add(routeDescriptor);
}
}
public IEnumerable<RouteDescriptor> GetRoutes()
{
return new[] {
new HttpRouteDescriptor {
Name = "ModuleName",
Priority = 5,
RouteTemplate = "api/modulename/{controller}/{id}",
Defaults = new {
area = "ModuleName",
id = RouteParameter.Optional
}
}
};
}
}
}
Then i have added an apicontroller:
using Newtonsoft.Json.Linq;
using Orchard;
using Orchard.Data;
using ModuleName.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
namespace ModuleName.Controllers
{
public class ConsumptionController : ApiController
{
public IOrchardServices Services { get; private set; }
private readonly IRepository<Vessel_ConsumptionPartRecord> _repository;
public ConsumptionController(IOrchardServices orchardServices,IRepository<Vessel_ConsumptionPartRecord> repository)
{
_repository = repository;
}
// GET: Home
public HttpResponseMessage Get()
{
...
}
}
}
I am on Localhost and the home url is:
http://localhost:30321/OrchardLocal
When i go to
http://localhost:30321/OrchardLocal/api/ModuleName/Consumption
I get a Not Found page.
Can anyone shed some light?
Your GET method does not have a parameter id. That might be it
I had this earlier today with a web api call. Turns out changing the link worked for me.
I went from using http://localhost:30321/Orchard.web/api/ModuleName/Get to using http://localhost:30321/api/ModuleName/Get when I was testing using the Postman Chrome extension

Categories

Resources