我正在使用webapi与我的WPF应用程序进行通信,当我在localhost下运行我的应用程序时工作正常但是当我将它发布到azure时,api路由会给我一个错误消息。这对我来说没有意义,因为两者都需要包含相同的文件。仅当数据在表中时,数据库为空时,azure网站不会返回错误。我完成了删除我的azure发布设置和数据库
This is the link of my azure application
public class Gebruiker
{
[Key]
public int Id { get; set; }
[Required(ErrorMessage= "Achternaam niet ingevuld")]
[DataType(DataType.Text)]
[Display(Name = "Achternaam")]
public string Naam { get; set; }
[Required(ErrorMessage = "Voornaam niet ingevuld")]
[DataType(DataType.Text)]
[Display(Name = "Voornaam")]
public string Voornaam { get; set; }
[Required(ErrorMessage = "Email niet ingevuld")]
[DataType(DataType.EmailAddress)]
[Display(Name = "Email")]
public string Email { get; set; }
[Required(ErrorMessage = "Adress niet ingevuld")]
[DataType(DataType.Text)]
[Display(Name = "Address ")]
public string Address { get; set; }
[Required(ErrorMessage = "Wachtwoord niet ingevuld")]
[DataType(DataType.Password)]
[Display(Name = "Wachtwoord")]
[MinLength(5, ErrorMessage = "min length wachtwoord 5")]
public string Passwoord { get; set; }
public virtual ICollection<Comment> Comment { get; set; }
}
public class Organisator
{
[Key]
public int Id { get; set; }
[Required(ErrorMessage = "Organisatie naam is niet ingevuld")]
[Display(Name = "Organisatie naam")]
public string Organisatie { get; set; }
[DataType(DataType.Url)]
public string FacebookLink { get; set; }
public byte[] Pasfoto { get; set; }
public bool Goedgekeurd { get; set; }
// FK
public int GebruikerId { get; set; }
//navigation property
public Gebruiker Gebruiker { get; set; }
}
protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
base.OnModelCreating(modelBuilder);
// LINK NEWSFEED -> COMMENTS
modelBuilder.Entity<NewsFeed>().HasMany(s => s.Comment).WithRequired().HasForeignKey(h => h.NewsFeedId);
// LINK GEBRUIKER -> COMMENTS
modelBuilder.Entity<Gebruiker>().HasMany(s => s.Comment).WithOptional().HasForeignKey(h => h.GebruikerId);
}
// GET: api/Organisator
public IQueryable<Organisator> GetOrganisators()
{
return db.Organisators.Where(s => s.Goedgekeurd == false).Include("Gebruiker");
}