servicestack的元数据页面中的WSDL链接不起作用

本文关键字:WSDL 链接 不起作用 元数据 servicestack | 更新日期: 2023-09-27 18:12:22

我在ASP中并排运行servicestack。. NET webforms应用程序。元数据页面中的每个链接似乎都可以工作,除了两个WSDL链接(soap11、soap12)和调试信息部分下的"请求信息"链接。当我单击WSDL链接时,我得到一个无效的xml页面,上面写着"此配置不支持自动生成的WSDL"。当我点击请求信息链接时,它抛出一个堆栈跟踪错误,如下所示:

Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 
Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.
Source Error: 
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace: 

[NullReferenceException: Object reference not set to an instance of an object.]
   ServiceStack.Host.Handlers.RequestInfoHandler.ProcessRequest(IRequest httpReq, IResponse httpRes, String operationName) +1331
   System.Threading.Tasks.Task.Execute() +109
[AggregateException: One or more errors occurred.]
   System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken) +13985681
   System.Threading.Tasks.Task.Wait() +17
   System.Web.CallHandlerExecutionStep.OnAsyncHandlerCompletion(IAsyncResult ar) +282

这是我的Apphost

//Tell ServiceStack the name of your application and where to find your services
    public AppHost() : base("Beeline API", typeof(RequestService).Assembly) { }
public override void Configure(Funq.Container container)
{
    SetConfig(new HostConfig
    {
        WsdlServiceNamespace = "http://schemas.servicestack.net/types",
        HandlerFactoryPath = "SupplierAPI",
        DebugMode = true
    });
}
public override IServiceRunner<TRequest> CreateServiceRunner<TRequest>(ActionContext actionContext)
{
    return new APIServiceRunner<TRequest>(this, actionContext); //Cached per Service Action
}

下面是我的服务:

    namespace BeelineAPI.Supplier.ServiceInterface
{
    public class RequestService : Service
    {
        public SearchRequestResponse Any(SearchRequest searchRequest)
        {
            return new SearchRequestResponse(){RequestNumber = "1224"};
        }
    }
}

这是我的数据合同:

    [DataContract(Namespace = Config.WsdlNamespace)]
[Route("/Request/{RequestNumber}")]
public class SearchRequest : IReturn<SearchRequestResponse>
{
    [DataMember]
    public string RequestNumber { get; set; }
}
[DataContract(Namespace = Config.WsdlNamespace)]
public class SearchRequestResponse
{
    [DataMember]
    public string RequestNumber { get; set; }
}

这是我的网。配置与servicestack相关的内容:

  <location path="SupplierAPI">
<system.web>
  <httpHandlers>
    <add path="*" type="ServiceStack.HttpHandlerFactory, ServiceStack" verb="*"/>
  </httpHandlers>
</system.web>
<!-- Required for IIS 7.0 -->
<system.webServer>
  <modules runAllManagedModulesForAllRequests="true"/>
  <validation validateIntegratedModeConfiguration="false" />
  <handlers>
    <add path="*" name="ServiceStack.Factory"
         type="ServiceStack.HttpHandlerFactory, ServiceStack" verb="*"
         preCondition="integratedMode" resourceType="Unspecified" allowPathInfo="true" />
  </handlers>
</system.webServer>

我做错了什么?任何帮助都是感激的!!

servicestack的元数据页面中的WSDL链接不起作用

我终于把我的记录器连接到ServiceStack的日志记录,并得到了真正的错误:'Type ' api . provider . servicemodel . customfields。字段' 1[T]'不能导出为模式类型,因为它是一个开放的泛型类型。只有当泛型的所有泛型参数类型都是实际类型时,才能导出泛型。如果您的属性具有泛型类型,则WCF无法序列化以生成WSDL。对我来说是菲尔德。现在需要解决这个问题。这就是为什么我的WSDL链接被破坏了。