更新xamlx-workflow服务引用引发了XamlObjectWriterException:'无法创建未知类型[...]'

时间:2011-12-09 16:05:03

标签: wcf workflow-foundation-4

在vs 2010中,右键单击并更新指向我的xamlx工作流服务项目的服务引用,它会抛出一个错误(用原始html编写),说明:

  

XamlObjectWriterException:'无法创建未知类型[...]'

[...]指出我项目的消息变量。

我的工作流程是使用WorkflowServiceHost类托管的xamlx。

似乎是由于SendResponse消息。邮件类型使用[DataContract][DataMember],并且在内容用户界面中选择了“参数”。

无法找出我的消息类型究竟是什么。也许它是我的wkf项目的构建属性中的东西......

非常欢迎任何帮助。

这是发回的html:


There was an error downloading 'http://localhost:8008/WfDerogationCreation.xamlx'.
There was an error downloading 'http://localhost:8008/WfDerogationCreation.xamlx'.
The request failed with the error message:
--
<html>
    <head>
        <title>'Cannot create unknown type '{http://schemas.microsoft.com/netfx/2009/xaml/activities}Variable({clr-namespace:CompanyName.WorkflowSecurity.Derogation.Messages;assembly=CompanyName.WorkflowSecurity}DerogRequest)'.' Line number '4' and line position '8'.</title>
        <style>
         body {font-family:"Verdana";font-weight:normal;font-size: .7em;color:black;} 
         p {font-family:"Verdana";font-weight:normal;color:black;margin-top: -5px}
         b {font-family:"Verdana";font-weight:bold;color:black;margin-top: -5px}
         H1 { font-family:"Verdana";font-weight:normal;font-size:18pt;color:red }
         H2 { font-family:"Verdana";font-weight:normal;font-size:14pt;color:maroon }
         pre {font-family:"Lucida Console";font-size: .9em}
         .marker {font-weight: bold; color: black;text-decoration: none;}
         .version {color: gray;}
         .error {margin-bottom: 10px;}
         .expandable { text-decoration:underline; font-weight:bold; color:navy; cursor:hand; }
        </style>
    </head>
<body bgcolor="white">
            <span><H1>Server Error in '/' Application.<hr width=100% size=1 color=silver></H1>
            <h4> <i>'Cannot create unknown type '{http://schemas.microsoft.com/netfx/2009/xaml/activities}Variable({clr-namespace:CompanyName.WorkflowSecurity.Derogation.Messages;assembly=CompanyName.WorkflowSecurity}DerogRequest)'.' Line number '4' and line position '8'.</i> </h4></span>
            <font face="Arial, Helvetica, Geneva, SunSans-Regular, sans-serif ">
            <b> Description: </b>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.
            <br><br>
            <b> Exception Details: </b>System.Xaml.XamlObjectWriterException: 'Cannot create unknown type '{http://schemas.microsoft.com/netfx/2009/xaml/activities}Variable({clr-namespace:CompanyName.WorkflowSecurity.Derogation.Messages;assembly=CompanyName.WorkflowSecurity}DerogRequest)'.' Line number '4' and line position '8'.<br><br>
            <b>Source Error:</b> <br><br>
            <table width=100% bgcolor="#ffffcc">
               <tr>
                  <td>
                      <code>
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.</code>
                  </td>
               </tr>
            </table>
            <br>
            <b>Stack Trace:</b> <br><br>
            <table width=100% bgcolor="#ffffcc">
               <tr>
                  <td>
                      <code><pre>
[XamlObjectWriterException: 'Cannot create unknown type '{http://schemas.microsoft.com/netfx/2009/xaml/activities}Variable({clr-namespace:CompanyName.WorkflowSecurity.Derogation.Messages;assembly=CompanyName.WorkflowSecurity}DerogRequest)'.' Line number '4' and line position '8'.]
   System.Xaml.XamlObjectWriter.WriteStartObject(XamlType xamlType) +1131129
   System.Xaml.XamlWriter.WriteNode(XamlReader reader) +158
   System.Xaml.XamlServices.Transform(XamlReader xamlReader, XamlWriter xamlWriter, Boolean closeWriter) +106
   System.Xaml.XamlServices.Load(XamlReader xamlReader) +56
   System.ServiceModel.Activities.Activation.WorkflowServiceHostFactory.CreateServiceHost(String constructorString, Uri[] baseAddresses) +302
   System.ServiceModel.HostingManager.CreateService(String normalizedVirtualPath) +1461
   System.ServiceModel.HostingManager.ActivateService(String normalizedVirtualPath) +44
   System.ServiceModel.HostingManager.EnsureServiceAvailable(String normalizedVirtualPath) +651

[ServiceActivationException: The service '/WfDerogationCreation.xamlx' cannot be activated due to an exception during compilation.  The exception message is: 'Cannot create unknown type '{http://schemas.microsoft.com/netfx/2009/xaml/activities}Variable({clr-namespace:CompanyName.WorkflowSecurity.Derogation.Messages;assembly=CompanyName.WorkflowSecurity}DerogRequest)'.' Line number '4' and line position '8'..]
   System.Runtime.AsyncResult.End(IAsyncResult result) +688590
   System.ServiceModel.Activation.HostedHttpRequestAsyncResult.End(IAsyncResult result) +190
   System.ServiceModel.Activation.HostedHttpRequestAsyncResult.ExecuteSynchronous(HttpApplication context, String routeServiceVirtualPath, Boolean flowContext, Boolean ensureWFService) +234
   System.ServiceModel.Activation.HttpModule.ProcessRequest(Object sender, EventArgs e) +379
   System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +148
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +75
</pre></code>
                  </td>
               </tr>
            </table>
            <br>
            <hr width=100% size=1 color=silver>
            <b>Version Information:</b> Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.237
            </font>
    </body>
</html>
<!-- 
[XamlObjectWriterException]: 'Cannot create unknown type '{http://schemas.microsoft.com/netfx/2009/xaml/activities}Variable({clr-namespace:CompanyName.WorkflowSecurity.Derogation.Messages;assembly=CompanyName.WorkflowSecurity}DerogRequest)'.' Line number '4' and line position '8'.
   at System.Xaml.XamlObjectWriter.WriteStartObject(XamlType xamlType)
   at System.Xaml.XamlWriter.WriteNode(XamlReader reader)
   at System.Xaml.XamlServices.Transform(XamlReader xamlReader, XamlWriter xamlWriter, Boolean closeWriter)
   at System.Xaml.XamlServices.Load(XamlReader xamlReader)
   at System.ServiceModel.Activities.Activation.WorkflowServiceHostFactory.CreateServiceHost(String constructorString, Uri[] baseAddresses)
   at System.ServiceModel.ServiceHostingEnvironment.HostingManager.CreateService(String normalizedVirtualPath)
   at System.ServiceModel.ServiceHostingEnvironment.HostingManager.ActivateService(String normalizedVirtualPath)
   at System.ServiceModel.ServiceHostingEnvironment.HostingManager.EnsureServiceAvailable(String normalizedVirtualPath)
[ServiceActivationException]: The service '/WfDerogationCreation.xamlx' cannot be activated due to an exception during compilation.  The exception message is: 'Cannot create unknown type '{http://schemas.microsoft.com/netfx/2009/xaml/activities}Variable({clr-namespace:CompanyName.WorkflowSecurity.Derogation.Messages;assembly=CompanyName.WorkflowSecurity}DerogRequest)'.' Line number '4' and line position '8'..
   at System.Runtime.AsyncResult.End[TAsyncResult](IAsyncResult result)
   at System.ServiceModel.Activation.HostedHttpRequestAsyncResult.End(IAsyncResult result)
   at System.ServiceModel.Activation.HostedHttpRequestAsyncResult.ExecuteSynchronous(HttpApplication context, String routeServiceVirtualPath, Boolean flowContext, Boolean ensureWFService)
   at System.ServiceModel.Activation.HttpModule.ProcessRequest(Object sender, EventArgs e)
   at System.Web.HttpApplication.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
   at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
-->## Heading ##
--.
Metadata contains a reference that cannot be resolved: 'http://localhost:8008/WfDerogationCreation.xamlx'.
The server did not provide a meaningful reply; this might be caused by a contract mismatch, a premature session shutdown or an internal server error.
If the service is defined in the current solution, try building the solution and adding the service reference again.

2 个答案:

答案 0 :(得分:1)

我最终解决了这个问题:

在一对ReceiveResponse / SendReply活动中。

1 /删除SendReply。 2 /右键单击ReceiveResponse活动重新创建SendReply并重置已删除的属性。

Xamlx服务参考然后上传得很好......

发现错误信息非常不适合用原始html编写,我的屏幕不够大,无法读取所有内容。无论如何,谢谢你的帮助。

答案 1 :(得分:0)

这是Xaml堆栈告诉您它不知道CompanyName.WorkflowSecurity.Derogation.Messages的方式。你需要做的是弄清楚为什么它不知道这种类型。

虽然“CompanyName.WorkflowSecurity} DerogRequest”注意'}',但程序集名称确实看起来很奇怪?这是一个错字吗?

检查行号为“4”的XAMLX文件和行号“8”