问题描述
这个问题可能与 404 TFS时出错2010将SOAP警报发送到WCF 4.0服务或此 但我无法弄清楚哪里出了问题. (希望 Ewald 能够引起人们的注意)
This question is probably very similar to404 Error when TFS 2010 Sends SOAP Alert to a WCF 4.0 Service or this but I can not figure out where I went wrong. (So hoping that Ewald will chime in)
我仔细阅读了所有可以找到的示例和问题,但是无论如何,我仍然没有收到任何警报.
I went through all the samples and questions that I could find, but somehow, I still do not get any alerts to come through.
我的测试实现部署在azure上,并且我配置了免费的tfs服务(***.visualstudio.com),以将新的工作项实际发布到该端点.
My test implementation is deployed on azure and I configured my free tfs service (***.visualstudio.com) to actually post new work items to that endpoint.
当我自己创建客户端代理时,我可以看到数据到达.因此,代码/配置中肯定还有些问题吗?
When I create a client proxy myself, I can see the data arrive. So something must still be wrong in the code/configuration?
namespace Tfs.NotificationService
{
[ServiceContract(Namespace = "http://schemas.microsoft.com/TeamFoundation/2005/06/Services/Notification/03")]
public interface INotifyService
{
[OperationContract(Action = "http://schemas.microsoft.com/TeamFoundation/2005/06/Services/Notification/03/Notify")]
[XmlSerializerFormat(Style = OperationFormatStyle.Document)]
void Notify(string eventXml, string tfsIdentityXml);
}
public class NotifyService : INotifyService
{
void INotifyService.Notify(string eventXml, string tfsIdentityXml)
{
using (var db = new NotificationContext())
{
db.Notifications.Add(new Notification { EventXml = eventXml, TfsIdendityXml = tfsIdentityXml });
db.SaveChanges();
}
}
}
}
web.config文件:
The web.config file:
<system.serviceModel>
<bindings>
<wsHttpBinding>
<binding name="NotifyServiceBinding">
<security mode="None" />
</binding>
</wsHttpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior name="NotifyServiceBehavior">
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
</behaviors>
<services>
<service behaviorConfiguration="NotifyServiceBehavior" name="Tfs.NotificationService.NotifyService">
<endpoint address="" binding="wsHttpBinding" bindingConfiguration="NotifyServiceBinding"
contract="Tfs.NotificationService.INotifyService" />
</service>
</services>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
</system.serviceModel>
项目是一个ASP.Net MVC 4-.Net 4.5-带有EF 5.0,用于存储数据.
Project is a ASP.Net MVC 4 - .Net 4.5 - with EF 5.0 to store the data.
推荐答案
有效的解决方案:
namespace Tfs.NotificationService
{
[ServiceContract(Namespace = "http://schemas.microsoft.com/TeamFoundation/2005/06/Services/Notification/03")]
public interface INotifyService
{
[OperationContract(Action = "http://schemas.microsoft.com/TeamFoundation/2005/06/Services/Notification/03/Notify")]
[XmlSerializerFormat(Style = OperationFormatStyle.Document)]
void Notify(string eventXml, string tfsIdentityXml);
}
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
public class NotifyService : INotifyService
{
void INotifyService.Notify(string eventXml, string tfsIdentityXml)
{
// do something
}
}
}
Web.config:
Web.config:
<system.serviceModel>
<bindings>
<wsHttpBinding>
<binding name="NotifyServiceBinding">
<security mode="None" />
</binding>
</wsHttpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior name="NotifyServiceBehavior">
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
</behaviors>
<services>
<service behaviorConfiguration="NotifyServiceBehavior" name="Tfs.NotificationService.NotifyService">
<endpoint address="" binding="wsHttpBinding" bindingConfiguration="NotifyServiceBinding"
contract="Tfs.NotificationService.INotifyService" />
</service>
</services>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
</system.serviceModel>
这篇关于Team Foundation Service的SOAP警报的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!