调试WCF - 并且在我的生活中我无法弄清楚为什么我的服务方法返回http错误400. DLL部署在IIS中并且SVC指向它 - DLL中的所有其他服务方法都可用并返回正确的数据。我在IIS中的过程中附加了调试器,我可以逐步完成所有其他服务方法 - 但由于某种原因调试器甚至没有捕获对此方法的调用。符号已正确加载。我甚至试图打破所有异常 - 它不想因任何原因停在GetCustomInquiries_POST中,并且该服务仍然可用并在返回时显示http错误400。有任何想法吗?我知道我胖子在某个地方找到它。
我有以下合同的服务:
[OperationContract]
[WebInvoke(BodyStyle = WebMessageBodyStyle.Wrapped, ResponseFormat = WebMessageFormat.Json, RequestFormat = WebMessageFormat.Json)]
Stream GetCustomInquiries_POST();
以下实施:
public Stream GetCustomInquiries_POST()
{
// Returns a list of of business objects
CustomInquiries customInquiries = WebSupport.DocumentInquiry.GetCustomInquiries();
// Create an empty list of WCFCustomInquiry, which is a data
// contract that exposes certain properties of a customInquiry.
// This list will be filled with all of the saved inquiries
List<WCFCustomInquiry> customInquiriesToReturn = new List<WCFCustomInquiry>();
// For each of the inquiries that were returned.
foreach (CustomInquiry customInquiry in customInquiries)
{
// Create a list of properties exposed via the web service
List<WCFProperty> savedProperties = new List<WCFProperty>();
// For each of the properties in the saved inquiry, cast it to a WCFProperty,
// which is added to the list of properties exposed to the web service
foreach (InquiryPropertyValue testProperty in customInquiry.SearchCriteria.Properties.Values)
{
WCFProperty savedProperty = new WCFProperty(testProperty.PropertyID, testProperty.Prompt, testProperty.DataType);
savedProperty.inquirySearchText = testProperty.Value.ToString();
savedProperty.inquirySearchType = testProperty.SearchType;
savedProperties.Add(savedProperty);
}
// create a new webInquiryCriteria instance, which exposes the listed
// properties to the web service.
WCFInquiryCriteria webInquiryCriteria = new WCFInquiryCriteria(customInquiry.TopLevelFolders, customInquiry.DocTypes, customInquiry.SearchCriteria.DocumentTypes, customInquiry.SearchCriteria.TopLevelFolders, savedProperties, "", "", false, null, null);
// Created an instance of the data-contract, using the members
// to be exposed from the inquiry
WCFCustomInquiry customInquiryToReturn = new WCFCustomInquiry(customInquiry.CustomInquiryId, customInquiry.Name, customInquiry.Description, customInquiry.AutoRun, customInquiry.DocTypes, customInquiry.TopLevelFolders, webInquiryCriteria, customInquiry.UserSuppliedProperties);
// Add that new instance to the list that
customInquiriesToReturn.Add(customInquiryToReturn);
}
return WebSupport.JSONSerializationHelper.GetJSONStreamToReturn(customInquiriesToReturn);
}