在另一个 IIS 中发布我的 API 项目

Publishing my API project in another IIS

我的 API 项目已经发布了好几次,没有任何问题。但是当我在我的一个服务器的 IIS 中发布相同的发布文件时,它会引发一个关于我的控制器的错误。 我已经检查过了,它在我的本地和另一个 IIS 中都能正常工作。

This XML file does not appear to have any style information associated with it. The document tree is shown below. An error has occurred. An error occurred when trying to create a controller of type 'CityController'. Make sure that the controller has a parameterless public constructor. System.InvalidOperationException at System.Web.Http.Dispatcher.DefaultHttpControllerActivator.Create(HttpRequestMessage request, HttpControllerDescriptor controllerDescriptor, Type controllerType) at System.Web.Http.Controllers.HttpControllerDescriptor.CreateController(HttpRequestMessage request) at System.Web.Http.Dispatcher.HttpControllerDispatcher.d__1.MoveNext() An error has occurred. Type 'Jabama.Web.API.Controllers.CityController' does not have a default constructor System.ArgumentException at System.Linq.Expressions.Expression.New(Type type) at System.Web.Http.Internal.TypeActivator.Create[TBase](Type instanceType) at System.Web.Http.Dispatcher.DefaultHttpControllerActivator.GetInstanceOrActivator(HttpRequestMessage request, Type controllerType, Func`1& activator) at System.Web.Http.Dispatcher.DefaultHttpControllerActivator.Create(HttpRequestMessage request, HttpControllerDescriptor controllerDescriptor, Type controllerType)

我检查了所有cityController的依赖项,没有任何问题。

我终于找到问题所在了。当我发布 API 项目时,它没有在它的 bin 中发布 Microsoft.SqlServer.Type dll folder.I 将 dll 手动复制到那个 IIS 并且它可以工作,但我不知道它为什么会给出我这样的错误!甚至现在我的新 IIS 出了什么问题,API 没有这个 dll 就无法工作,而另一个 IIS 即使没有复制它也能工作!