2014-07-09 35 views
0

我在ASP.NET webforms應用程序中並排運行servicestack。除了兩個WSDL鏈接(soap11,soap12)和調試信息部分下的「請求信息」鏈接之外,元數據頁面中的每個鏈接似乎都可以工作。當我點擊WSDL鏈接時,出現一個無效的xml頁面,其中顯示「此配置不支持自動生成的WSDL」。當我點擊索取信息鏈接,它拋出一個堆棧跟蹤如下錯誤:ServiceStack的元數據頁面中的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; } 
} 

這裏是我的web.config,因爲它涉及到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> 

我在做什麼錯?任何幫助表示讚賞!

+0

歡迎來到SO。很高興你解決了你的問題。你可以請你的解決方案作爲答案而不是評論,因此這個問題可以被關閉。 – Scott

回答

1

我終於把我的記錄器連接到了ServiceStack的日誌記錄,並得到了真正的錯誤:'Type'API.Supplier.ServiceModel.CustomFields.Field`1 [T]'不能作爲模式類型導出,因爲它是一個開放的通用類型。如果所有通用參數類型都是實際類型,則只能導出通用類型。'如果您有一個通用類型的屬性,WCF將無法序列化以生成WSDL。就我而言,這是Field。現在需要解決這個問題。這就是爲什麼我的WSDL鏈接被破壞。

相關問題