小编Pre*_*hts的帖子

在applicationhost.config中访问环境变量

我有一个环境变量MyLocation 当我在applicationhost.config中设置此环境变量的虚拟目录物理路径时.我们到处都是404,这意味着变量设置不正确.

 <virtualDirectory path="/" physicalPath="%MyLocation%" />
Run Code Online (Sandbox Code Playgroud)

我验证了变量存在.在机器和用户下尝试过.

我们的applicationhost.config包含在TFS中,这就是我们要将位置设置为环境变量的原因.有人试过吗?并且有运气吗?

environment-variables iis-express

9
推荐指数
1
解决办法
794
查看次数

如何在Web项目中使用慢速猎豹转换配置文件

所以我想要完成的是转换构建中的所有配置文件.

  • Web.config文件
  • App.config中
  • .... config.xml中

在项目文件中,它们看起来像这样:

<None Include="FooBar.config.xml">
  <TransformOnBuild>true</TransformOnBuild>
</None>
<None Include="FooBar.config.Release.xml">
  <DependentUpon>FooBar.config.xml</DependentUpon>
  <IsTransformFile>True</IsTransformFile>
</None>
Run Code Online (Sandbox Code Playgroud)

一切都适用于Windows服务和Windows应用程序.但对于网络项目来说,慢速猎豹并没有进行变革.经过一些研究后,我发现:"对于Web项目,当您发布或打包应用程序时,文件会被转换." 从慢速猎豹扩展页面.事实上,当我发布Web项目时,转换正确完成.

那么如何更改慢速猎豹默认行为并在构建服务器上执行所有变换?

环境:

  • TFS 2010
  • 构建服务器上的慢速猎豹版本:1.0.10727.0

msbuild slowcheetah

9
推荐指数
1
解决办法
7802
查看次数

ISupportIncrementalLoading与VariableSizedWrapGrid结合使用

我有一个ObservableCollection<T>实现ISupportIncrementalLoading接口.

当我将此集合绑定到普通的gridview时,一切正常.

但是当我将ItemsPanel模板更改为VariableSizedWrapGrid时.增量加载不再起作用.

有效的Xaml:

<ItemsPanelTemplate>                        
    <VirtualizingStackPanel Orientation="Horizontal"/>
</ItemsPanelTemplate>
Run Code Online (Sandbox Code Playgroud)

Xaml不起作用:

<ItemsPanelTemplate>
    <VariableSizedWrapGrid Orientation="Vertical" ItemHeight="250" ItemWidth="250"  Margin="0,0,80,0"/>
</ItemsPanelTemplate>
Run Code Online (Sandbox Code Playgroud)

我也发现了这个这个.说明VariableSizedWrapGrid不支持ISupportIncremetalLoading.

是否有人编写过VariableSizedWrapGrid,它支持增量加载?还是开源解决方案?

xaml lazy-loading windows-runtime

8
推荐指数
1
解决办法
1080
查看次数

调试后台任务

在我看来,我的后台任务不起作用/触发.有什么方法可以调试它们,或者用集成测试来测试它.

这是一个示例后台任务:


public sealed class MyBackgroundTask : IBackgroundTask
{
 private ITileService _tileService;

 //Tried a parameter-less constructor in case IoC doesn't work
 public MyBackgroundTask() : this(new TileService)  {}

 public MyBackgroundTask(ITileService tileService)
 {
     _tileService = tileservice;
 }

        public async void Run(IBackgroundTaskInstance taskInstance)
        {
            Debug.WriteLine("MyBackgroundTask is running " + taskInstance.Task.Name );
            taskInstance.Canceled += TaskInstanceOnCanceled;
            if (!_cancelRequest && SomeOtherCondition)
            {
                var deferral = taskInstance.GetDeferral(); 
                await _tileService.UpdateLiveTile(null);
                deferral.Complete();
            }
        }
}
Run Code Online (Sandbox Code Playgroud)

注册后台任务:(运行此代码,使用调试器检查)


var backgroundTaskBuilder = new BackgroundTaskBuilder
                                                {
                                                    TaskEntryPoint =
                                                        "MyNamespace.MyBackgroundTask",
                                                    Name = "MyBackgroundTask"
                                                }; …
Run Code Online (Sandbox Code Playgroud)

c# live-tile windows-runtime

7
推荐指数
0
解决办法
3510
查看次数

每个端点的不同服务行为

情况

我们正在某些WCF服务上实现不同类型的安全性.ClientCertificate,UserName&Password和Anonymous.

我们有2个ServiceBehaviorConfigurations,一个用于httpBinding,另一个用于wsHttpBinding.(我们有基于声明的安全性的自定义授权策略)作为一项要求,我们需要为每项服务提供不同的端点.带有httpBinding的3个端点和带有wsHttpBinding的1个端点.

一项服务的示例:

  • basicHttpBinding:匿名
  • basicHttpBinding:UserNameAndPassword
  • basicHttpBinding:BasicSsl
  • wsHttpBinding:BasicSsl

注意:我们正在开发.NET 3.5

问题

第1部分:我们不能两次指定相同的服务,一次使用http服务配置,一次使用wsHttp服务配置.

第2部分:我们无法在端点上指定服务行为.(抛出和异常,未找到端点行为...服务行为无法设置为端点行为)

配置

第1部分:

<services>
  <service name="Namespace.MyService" behaviorConfiguration="securityBehavior">
   <endpoint address="http://server:94/MyService.svc/Anonymous" contract="Namespace.IMyService" binding="basicHttpBinding" bindingConfiguration="Anonymous">
    </endpoint> 
    <endpoint address="http://server:94/MyService.svc/UserNameAndPassword" contract="Namespace.IMyService" binding="basicHttpBinding" bindingConfiguration="UserNameAndPassword">
    </endpoint>
    <endpoint address="https://server/MyService.svc/BasicSsl" contract="Namespace.IMyService" binding="basicHttpBinding" bindingConfiguration="BasicSecured">
    </endpoint>
  </service>
  <service name="Namespace.MyService" behaviorConfiguration="wsHttpCertificateBehavior">
    <endpoint address="https://server/MyService.svc/ClientCert" contract="Namespace.IMyService" binding="wsHttpBinding" bindingConfiguration="ClientCert"/>
  </service>
</services>
Run Code Online (Sandbox Code Playgroud)

服务行为配置:

<serviceBehaviors>
<behavior name="securityBehavior">
  <serviceAuthorization serviceAuthorizationManagerType="Namespace.AdamAuthorizationManager,Assembly">
    <authorizationPolicies>
      <add policyType="Namespace.AdamAuthorizationManager,Assembly" />
    </authorizationPolicies>
  </serviceAuthorization>
</behavior>
<behavior name="wsHttpCertificateBehavior">
  <serviceMetadata httpGetEnabled="false" httpsGetEnabled="true"/>
  <serviceAuthorization serviceAuthorizationManagerType="Namespace.AdamAuthorizationManager,Assembly">
    <authorizationPolicies>
      <add policyType="Namespace.AdamAuthorizationManager,Assembly" />
    </authorizationPolicies>
  </serviceAuthorization>
  <serviceCredentials>
    <clientCertificate> …
Run Code Online (Sandbox Code Playgroud)

wcf claims-based-identity servicebehavior endpointbehavior

7
推荐指数
1
解决办法
4810
查看次数

适用于Windows 8 metro应用程序的依赖注入框架

我似乎无法找到Windows 8 metro应用程序的依赖注入框架.

是否有win8 metro应用程序的框架?

Ninject尚未支持win8 metro.那么有人有建议吗?(城堡,春天......)

dependency-injection microsoft-metro windows-8

6
推荐指数
2
解决办法
2585
查看次数

声纳没有选择 Visual Studio 测试报告路径

我们在 TFS (2010) 团队构建上运行 SonarQube(5.0.1) 和 sonar.net-runner。

FxCop 工作正常,一切运行完美,我在声纳中看到了所有问题。

但是,当我尝试在声纳中提取测试结果时,我遇到了问题。

当我将该属性设置为sonar.cs.vstest.reportsPaths文件的绝对文件时trx,它会将我的测试结果发布到声纳。太好了

但是当我使用通配符时,我的测试结果不会在声纳中发布。不太好

我试过的配置。


#1
sonar.cs.vstest.reportsPaths=E:/Builds/1/74/TestResults/*.trx

#2
sonar.cs.vstest.reportsPaths=TestResults/*.trx

#3
sonar.cs.vstest.reportsPaths=**/*.trx

#4
sonar.cs.vstest.reportsPaths=.**/*.trx
Run Code Online (Sandbox Code Playgroud)

完整配置




# ----- Project identification
sonar.projectVersion=2.6.0.0914
sonar.projectName=MySolution
sonar.projectKey=Company:MySolution

# ----- Use UTF-8 encoding, otherwise analysis is unable to read files
sonar.sourceEncoding=UTF-8

# ----- Visual studio bootstrapper
# Enable the Visual Studio bootstrapper
sonar.visualstudio.enable=true

#Define the solution to run sonar against
sonar.visualstudio.solution=MySolution.sln

#Specify the pattern of the test projects
sonar.visualstudio.testProjectPattern=.*Test*.

#We are using …
Run Code Online (Sandbox Code Playgroud)

unit-testing sonar-runner sonarqube

5
推荐指数
1
解决办法
3199
查看次数

在Nhibernate中多次映射一列

我有一个实体。具有以下属性:

public class Entity
{
   public int CustomerId { get; set; }
   public Customer { get; set; } 
}
Run Code Online (Sandbox Code Playgroud)

如何两次映射CustomerId。一次是int属性,一次是多对一关系?

<many-to-one name="Customer" column="[CustomerId]" class="Customer"/>
<property name="CustomerId" column="[CustomerId]" type="Int64" />
Run Code Online (Sandbox Code Playgroud)

只是这个,行不通。我已经尝试过,使它们成为只读但没有成功。

nhibernate nhibernate-mapping

2
推荐指数
1
解决办法
1018
查看次数