问题
The reason I ask, is that I've set up a WCF service following the guidance out there (specifics below), and set up a SOAP notification in Visual Studio Online and my service doesn't appear to be called. IIS 8.5 Logs show no attempt to make contact with the service from VSO servers.
In case it IS supported, here are relevant bits to see if I have something set up wrong on the service side.
WCF Service - .NET 4.5.1 hosted as an Azure WebRole
Contract and Implementation
[ServiceContract(Namespace = "http://schemas.microsoft.com/TeamFoundation/2005/06/Services/Notification/03")]
public interface IWorkItemSubscriber
{
[OperationContract(Action = "http://schemas.microsoft.com/TeamFoundation/2005/06/Services/Notification/03/Notify")]
[XmlSerializerFormat(Style = OperationFormatStyle.Document)]
void Notify(string eventXml, string tfsIdentityXml);
}
// Note, I've tried w/ and w/out this Compatibility Attribute
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
public class WorkItemSubscriber : IWorkItemSubscriber
{
public void Notify(string eventXml, string tfsIdentityXml)
{
// Do stuff
}
}
Web.Config
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.5.1" />
<customErrors mode="Off"/>
</system.web>
<system.serviceModel>
<bindings>
<wsHttpBinding>
<binding name="noSecurity">
<security mode="None" />
</binding>
</wsHttpBinding>
</bindings>
<services>
<service name="VsoNotificationService.Wcf.WorkItemSubscriber" behaviorConfiguration="eventServiceBehavior">
<endpoint address="" binding="wsHttpBinding" bindingConfiguration="noSecurity" contract="VsoNotificationService.Wcf.IWorkItemSubscriber" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="eventServiceBehavior">
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="true"/>
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true" aspNetCompatibilityEnabled="true" /> <!-- note: I've tried w/ and w/out the aspNetCompatibilityEnabled attribute -->
</system.webServer>
</configuration>
Visual Studio Online Configuration
I've confirmed I can hit the service, via creating my own client and calling the service. Whatever code I put in the method is executed, and if I do remote debugging via Visual Studio 2013 I'll hit the method's breakpoint. So the service is up and running, I just don't see traffic from Visual Studio Online (via code breakpoint, code content, nor IIS Logs). Makes me think that feature is not working there?
回答1:
I see that you are missing the aspNetCompatibilityEnabled="true"
on the <serviceHostingEnvironment
element, as compared to my working solution, it might be the missing piece of the puzzle?
I only also achieved success by carefully including all little config settings.
来源:https://stackoverflow.com/questions/23139632/does-visual-studio-online-support-soap-workitem-change-notification