小编use*_*446的帖子

我可以使用mvn install:install-file安装mysql jdbc连接器吗?

我想使用maven安装JDBC连接器.

我有以下内容:mvn install:install-file -DgroupId = mysql -DartifactId = mysql-connnector-java -Dversion = 5.1.6 -Dpackaging = jar -Dfile = -DgenerationPom = true

我认为我需要的只是我放在= Dfile =的另一边?

我有一段时间没有使用过maven,所以我不确定文件开关的用途是什么?

感谢所有的见解!

mysql jdbc maven

10
推荐指数
1
解决办法
3万
查看次数

如何从经过身份验证的 SecurityToken 中获取声明

我将令牌作为字符串传递到 SOAP 服务中,并已验证令牌有效。我现在有一个 SecurityToken,在调试模式下我可以看到所有声明,特别是我想传递给另一个方法的 userId 声明。我似乎无法弄清楚如何获得索赔。现在我解码了令牌的字符串版本(令牌的未验证字符串版本,我至少等到验证成功之后。)这是代码块:

SecurityToken validatedToken = null;

if (VerifyToken(sPassword, ref response, ref validatedToken))
{
    var claimsObj = JObject.Parse(Encoding.UTF8.GetString(Base64Url.Decode(claims)));
    JToken userId = claimsObj.GetValue("userId");
    return implClass.Process(userId);
}
Run Code Online (Sandbox Code Playgroud)

如何从 SecurityToken 中获取声明?

validatedToken.Id; // not it
validatedToken.ToClaimsPrincipal(cert); // doesn't work
Run Code Online (Sandbox Code Playgroud)

就公开的属性而言,对我来说似乎没有其他希望,但由于我可以在调试器中看到声明,我确信有一种我没有看到的方法。

c# jwt identityserver3

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

升级到Visual Studio 2015或.NET 4.6.1后,Visual Studio中的C#项目找不到系统库

我有一个在Windows 8.1下使用Visual Studio Professional 2013(版本12.0.40629.00更新5)构建没有问题的解决方案.该环境中的每个项目都有一个".NET Framework 4.6.1"的Target框架.我称之为"旧"环境

当我使用Visual Studio Community 2015(版本14.0.24720.00 Update 1)在Windows 10机器上提取解决方案时,解决方案下的一些项目无法找到"系统"程序集.这是"新"环境

项目中"旧"环境下的System.dll属性未在"新建"环境下构建,显示"C:\ Program Files(x86)\ Reference Assemblies\Microsoft\Framework.NETFramework\v4"的预期路径.6.1\System.dll中"

在"新建"环境中的同一项目中,系统程序集没有路径,Resolved为"False"并且在Reference上有一个黄色三角形.

我试图在"新"环境中删除并读取引用,但它仍然在系统程序集的引用上显示黄色三角形.

"新建"环境中的其他项目使系统程序集解析的路径与"旧"环境中的路径相同.

我一直在选择系统程序集,但同样的事情发生在我引用的任何系统程序集的几个项目中,如System.Core,System.Data,System.Web,System.Xml等...

我错过了什么?我需要提供哪些其他信息来帮助我解决系统程序集?

更新:想一想项目没有建立的原因

在项目文件中,我删除了以下内容并能够成功重建:

<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
  <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
    <PropertyGroup>
      <ErrorText>This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them.  For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
    </PropertyGroup>
    <Error Condition="!Exists('$(SolutionDir)\.nuget\NuGet.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\.nuget\NuGet.targets'))" />
  </Target>
Run Code Online (Sandbox Code Playgroud)

为什么项目文件中的Nuget配置信息会阻止我的项目构建,但仅限于"新"环境?

.net c# visual-studio-2015

5
推荐指数
0
解决办法
4361
查看次数

在Web API帮助页面上修改简介

我已经使用REST端点增强了较旧的SOAP样式的Web服务。大多数内容都可以正常运行,但是我还无法弄清楚如何更改自动生成的帮助文件的简介。我现在所看到的是将介绍显示为“在此处提供您的API的一般说明”。

我已经关注了这个类似的问题,但是没有解释在哪里更改简介,并且没有其他文档记录在案,但是仍然不知道在哪里更改简介。

我应该使用Web-API的版本2。

c# asp.net-web-api-helppages asp.net-web-api2

4
推荐指数
1
解决办法
1673
查看次数

尝试使用M2e(Maven)构建时使Eclipse Luna识别出方面标注

我想开始在Java代码中使用Aspects,并发现一个RetryOnFailure批注,我认为这是我的第一个。起初,我的POM文件显示错误,但是通过一些研究,eclipse中的m2e似乎不知道何时运行/构建,因此我不得不在我的POM中添加一个lifecycleMappingMetadata,这使我无法通过。但是,我仍然在Eclipse中的注释上的类文件中收到错误。任何想法如何超越那将不胜感激。

相关的类文件:

    @RetryOnFailure(attempts = 2, delay = 10, verbose = false)
private static LeadQualificationResponse callLeadQualificaiton(LeadQualificationRequest leadQualificationRequest, MidasStub midasStub) throws RemoteException {
    LeadQualificationResponse leadQualificationResponse = null;
    leadQualificationResponse = midasStub.leadQualification(leadQualificationRequest);
    return leadQualificationResponse;
}
Run Code Online (Sandbox Code Playgroud)

POM片段:

        <pluginManagement>
        <plugins>
            <plugin>
                <groupId>org.eclipse.m2e</groupId>
                <artifactId>lifecycle-mapping</artifactId>
                <version>1.0.0</version>
                <configuration>
                    <lifecycleMappingMetadata>
                        <pluginExecutions>
                            <pluginExecution>
                                <pluginExecutionFilter>
                                    <groupId>com.jcabi</groupId>
                                    <artifactId>jcabi-maven-plugin</artifactId>
                                    <versionRange>[0.8,)</versionRange>
                                    <goals>
                                        <goal>ajc</goal>
                                    </goals>
                                </pluginExecutionFilter>
                                <action>
                                    <execute>
                                        <runOnIncremental>false</runOnIncremental>
                                    </execute>
                                </action>
                            </pluginExecution>
                        </pluginExecutions>
                    </lifecycleMappingMetadata>
                </configuration>
            </plugin>
        </plugins>
    </pluginManagement>
<plugins>
        <plugin>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.1</version>
            <configuration>
                <source>1.6</source>
                <target>1.6</target>
            </configuration>
        </plugin>
        <plugin>
            <groupId>com.jcabi</groupId>
            <artifactId>jcabi-maven-plugin</artifactId>
            <version>0.8</version>
            <executions>
                <execution>
                    <goals>
                        <goal>ajc</goal>
                    </goals> …
Run Code Online (Sandbox Code Playgroud)

java eclipse m2eclipse aspectj-maven-plugin

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

使用Polly时VS Debugger中报告的异常User-Unhandled

在调用Pittney Bowes Geocoder服务时,我正在使用Polly来捕捉异常.我正在使用一个抛出MessageProcessingException的g1client库.如果抛出此异常,我已经将调用包装在Polly网络策略中以重试调用最多3次,但Visual Studio坚持异常为"User-Unhandled"我需要修改哪些内容才能处理此异常?我正在使用Visual Studio 2017社区版和C#4.6.1.

try
{
    var networkPolicy = Policy
                              .Handle<MessageProcessingException>()
                              .Or<Exception>()
                              .WaitAndRetry(
                                   3,
                                   retryAttempt => TimeSpan.FromSeconds(Math.Pow(2, retryAttempt)),
                                   (exception, timeSpan, context) =>
                                   {
                                       System.Diagnostics.Debug.WriteLine("Exception being retried" + exception);
                                   });
    geocoderResponse = networkPolicy.Execute(() => geocoderService.Process(geocoderRequest));
}
catch (MessageProcessingException ex)
{
    log.Error("MessageProcessingException calling the Geocoder service", ex);
    throw ex;
}
catch (Exception ex)
{
    log.Error("Exception calling the Geocoder service", ex);
    throw ex;
}
Run Code Online (Sandbox Code Playgroud)

错误消息是:

g1client.MessageProcessingException occurred
  HResult=0x80131500
  Message=Unable to read data from the transport connection: A connection attempt failed because …
Run Code Online (Sandbox Code Playgroud)

c# networking geocoding unhandled-exception polly

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