I am trying to learn to use file layout and For now I just wanted my static fields to be sorted according to access modifiers. First private and then public .
I created a file layout and then used code cleanup but nothing changes in my code. please help
XAML code
<?xml version="1.0" encoding="utf-16"?>
<Patterns xmlns="urn:schemas-jetbrains-com:member-reordering-patterns">
<FilePattern>
<Entry DisplayName="Sort statics">
<Entry.Match>
<Static />
</Entry.Match>
<Entry.SortBy>
<Access />
<Name />
</Entry.SortBy>
</Entry>
</FilePattern>
</Patterns>
Try this pattern (now it has the "Fields" region you showed on the video)
<?xml version="1.0" encoding="utf-16"?>
<Patterns xmlns="urn:schemas-jetbrains-com:member-reordering-patterns">
<TypePattern DisplayName="Default Pattern">
<Region Name="Fields">
<Entry DisplayName="Sort static by access modifier" Priority="100">
<Entry.Match>
<And>
<Kind Is="Field" />
<Static />
</And>
</Entry.Match>
<Entry.SortBy>
<Access Order="Private Protected ProtectedInternal Internal Public" />
<Name />
</Entry.SortBy>
</Entry>
</Region>
</TypePattern>
</Patterns>
Related
I developed a wcf webservice in a sharepoint 2016 on premise environment.
When I try to upload a long body I used to get a 413 payload too large error so I changed my app.config to this:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior name="">
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
</behaviors>
<services>
<service name="ilem.Sharepoint.WebServices.ISAPI.ilemGroupWS.Service">
<endpoint address="" binding="basicHttpBinding" contract="ilem.Sharepoint.WebServices.ISAPI.ilemGroupmWS.IService">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="http://localhost:8733/Design_Time_Addresses/ilem.Sharepoint.WebServices.ISAPI.ilemGroup/Service/" />
</baseAddresses>
</host>
</service>
</services>
<standardEndpoints>
<webHttpEndpoint>
<standardEndpoint name=""
helpEnabled="true"
automaticFormatSelectionEnabled="true"
maxReceivedMessageSize="2147000000"
/>
</webHttpEndpoint>
</standardEndpoints>
<bindings>
<basicHttpBinding>
<binding name="MyBinding" maxBufferPoolSize="2000000000"
maxBufferSize="2000000000" maxReceivedMessageSize="2000000000">
<readerQuotas maxDepth="32"
maxArrayLength="200000000"
maxStringContentLength="200000000"/>
</binding>
</basicHttpBinding>
<basicHttpsBinding>
<binding name="MyBinding" maxBufferPoolSize="2000000000"
maxBufferSize="2000000000" maxReceivedMessageSize="2000000000">
<readerQuotas maxDepth="32"
maxArrayLength="200000000"
maxStringContentLength="200000000"/>
</binding>
</basicHttpsBinding>
</bindings>
</system.serviceModel>
</configuration>
But now I get this error: 500 (System.ServiceModel.ServiceActivationException)
Is there any way to resolve this issue?
I found that behaviorConfiguration, bindingConfiguration, <security mode="Transport"> are not set in your code, please make sure to configure them.
You can try setting includeExceptionDetailInFaults to true or configuring tracing to get error details.
From the docs https://github.com/NLog/NLog/wiki/Database-target
It seems settings are shown as attributes on the target element such as:
<target xsi:type="Database"
name="String"
dbUserName="Layout"
dbProvider="String"
and in the example below as separate child nodes:
<target name="database" xsi:type="Database">
<connectionStringName>NLogDb</connectionStringName>
Neither work for me, I just get Invalid configuration exceptions with this message:
NotSupportedException: Parameter connectionStringName not supported on DatabaseTarget
The Config File:
<?xml version="1.0" encoding="utf-8" ?>
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
autoReload="true"
internalLogLevel="info"
throwExceptions="true"
internalLogFile="c:\temp\internal-nlog.txt">
<!-- enable asp.net core layout renderers -->
<extensions>
<add assembly="NLog.Web.AspNetCore"/>
</extensions>
<!-- the targets to write to -->
<targets>
<!-- write logs to file -->
<target xsi:type="File" name="allfile" fileName="c:\temp\nlog-all-${shortdate}.log"
layout="${longdate}|${event-properties:item=EventId_Id}|${uppercase:${level}}|${logger}|${message} ${exception:format=tostring}" />
<!-- another file log, only own logs. Uses some ASP.NET core renderers -->
<target xsi:type="File" name="ownFile-web" fileName="c:\temp\nlog-own-${shortdate}.log"
layout="${longdate}|${event-properties:item=EventId_Id}|${uppercase:${level}}|${logger}|${message} ${exception:format=tostring}|url: ${aspnet-request-url}|action: ${aspnet-mvc-action}" />
<target xsi:type="Database"
name="database"
keepConnection="true"
useTransactions="true"
dbProvider="System.Data.SqlClient"
connectionStringName="DefaultConnection"
commandText="INSERT INTO Logs (EventDateTime, EventLevel, UserName, MachineName, EventMessage, ErrorSource, ErrorClass, ErrorMethod, ErrorMessage, InnerErrorMessage) VALUES (#EventDateTime, #EventLevel, #UserName, #MachineName, #EventMessage, #ErrorSource, #ErrorClass, #ErrorMethod, #ErrorMessage, #InnerErrorMessage)">
<parameter name="#EventDateTime" layout="${date:s}" />
<parameter name="#EventLevel" layout="${level}" />
<parameter name="#UserName" layout="${aspnet-user-identity}" />
<parameter name="#MachineName" layout="${machinename}" />
<parameter name="#EventMessage" layout="${message}" />
<parameter name="#ErrorSource" layout="${event-context:item=error-source}" />
<parameter name="#ErrorClass" layout="${event-context:item=error-class}" />
<parameter name="#ErrorMethod" layout="${event-context:item=error-method}" />
<parameter name="#ErrorMessage" layout="${event-context:item=error-message}" />
<parameter name="#InnerErrorMessage" layout="${event-context:item=inner-error-message}" />
</target>
</targets>
<!-- rules to map from logger name to target -->
<rules>
<!--All logs, including from Microsoft-->
<logger name="*" minlevel="Trace" writeTo="allfile,database" />
<!--Skip non-critical Microsoft logs and so log only own logs-->
<logger name="Microsoft.*" maxLevel="Info" final="true
" />
<!-- BlackHole without writeTo -->
<logger name="*" minlevel="Trace" writeTo="ownFile-web" />
</rules>
</nlog>
How it is being called in program.cs
var logger = NLog.Web.NLogBuilder.ConfigureNLog( "nlog.config" ).GetCurrentClassLogger();
(copied from their docs)
Must be missing something obvious, but since there is conflicting info in the docs, and copying other people's configs posted on here, not sure where to go with it
Looks like you are running on NetCore. NLog is not able to read connectionStringName from AppSettings.json as you have found out yourself (Requires extra dependencies to access IConfiguration).
One possible solution is using this extension:
https://www.nuget.org/packages/NLog.Appsettings.Standard/
And use connectionString (Instead of connectionStringName) in NLog.config:
<extensions>
<add assembly="NLog.Web.AspNetCore"/>
<add assembly="NLog.Appsettings.Standard"/>
</extensions>
<target xsi:type="Database" connectionString="${appsettings:name=ConnectionStrings.DefaultConnection}">
Alternative solution is to assign a GDC variable before logging:
NLog.GlobalDiagnosticsContext.Set("DefaultConnection", Configuration.GetConnectionString("DefaultConnection"));
And then use GDC in NLog.config:
<target xsi:type="Database" connectionString="${gdc:item=DefaultConnection}">
See also https://github.com/NLog/NLog/wiki/Gdc-layout-renderer
Update NLog.Extension.Logging ver. 1.4.0
With NLog.Extension.Logging ver. 1.4.0 then you can now use ${configsetting}
See also: https://github.com/NLog/NLog/wiki/ConfigSetting-Layout-Renderer
We have a use case where we don't want to expose our cloud service to public and accessible only through our internal network. Is there a way to de associate the Public IP and access the cloud service through Internal IP. I already added CloudService to our VN but still i can access the CloudService through Public IP.
<NetworkConfiguration>
<VirtualNetworkSite name="xxxxVN" />
<AddressAssignments>
<InstanceAddress roleName="WorkerRole7">
<Subnets>
<Subnet name="default" />
</Subnets>
</InstanceAddress>
<InstanceAddress roleName="WebRole7">
<Subnets>
<Subnet name="default" />
</Subnets>
</InstanceAddress>
</AddressAssignments>
</NetworkConfiguration>
CSDEF:
<?xml version="1.0" encoding="utf-8"?>
<ServiceDefinition name="AzureCloudService7" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceDefinition" schemaVersion="2015-04.2.6">
<WebRole name="WebRole7" vmsize="Small">
<Sites>
<Site name="Web">
<Bindings>
<Binding name="Endpoint1" endpointName="Endpoint1" />
</Bindings>
</Site>
</Sites>
<ConfigurationSettings>
<Setting name="Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString" />
</ConfigurationSettings>
<Endpoints>
<InternalEndpoint name="Endpoint1" protocol="http" port="80" />
</Endpoints>
<Imports>
<Import moduleName="RemoteAccess" />
</Imports>
</WebRole>
<WorkerRole name="WorkerRole7" vmsize="Small">
<ConfigurationSettings>
<Setting name="Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString" />
</ConfigurationSettings>
<Imports>
<Import moduleName="RemoteAccess" />
<Import moduleName="RemoteForwarder" />
</Imports>
</WorkerRole>
</ServiceDefinition>>
when i removed Inputendpoint it is asking for binding, so i have given it as Internalendpoint and tried deploying it still am able to access the cloudservice with VIP.
The only ports available via the public load balancer (ie. the VIP) are the ones defined as InputEndpoints in your CSDEF file. So just remove those input endpoints and you will remove the ability to communicate to that VM from the public IP.
I've set up a node.js app to run on worker roles (not web roles) on Azure cloud services. Everything was working fine with the standard app running on HTTP.
Now I'm trying to get it running over SSL on HTTPS, and have successfully followed the instructions at http://www.windowsazure.com/en-us/develop/nodejs/common-tasks/enable-ssl-worker-role/ but it has not produced the correct results!
Now when accessing the url over either HTTP or HTTPS the connection times out and nothing is returned.
Is there anything I might be missing or any steps that aren't in the guide linked above?
One thing I did notice in the guide was whether the line...
<InputEndpoint name="HttpIn" protocol="tcp" port="443" />
... should in fact be HttpsIn instead? Though changing this doesn't seem to make a huge amount of difference.
Update: here are some of my configuration files
ServiceConfiguration.cloud.cscfg
<?xml version="1.0" encoding="utf-8"?>
<ServiceConfiguration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" serviceName="*removed*" osFamily="2" osVersion="*" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceConfiguration">
<Role name="WorkerRole1">
<ConfigurationSettings />
<Instances count="1" />
<Certificates>
<Certificate name="certificateName" thumbprint="*removed*" thumbprintAlgorithm="sha1" />
</Certificates>
</Role>
</ServiceConfiguration>
ServiceDefinition.csdef
<?xml version="1.0" encoding="utf-8"?>
<ServiceDefinition xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="*removed*" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceDefinition">
<WorkerRole name="WorkerRole1" vmsize="ExtraSmall">
<Startup>
<Task commandLine="setup_worker.cmd > log.txt" executionContext="elevated">
<Environment>
<Variable name="EMULATED">
<RoleInstanceValue xpath="/RoleEnvironment/Deployment/#emulated" />
</Variable>
<Variable name="RUNTIMEID" value="node" />
<Variable name="RUNTIMEURL" value="http://az413943.vo.msecnd.net/node/0.8.4.exe" />
</Environment>
</Task>
<Task commandLine="node.cmd .\startup.js" executionContext="elevated" />
</Startup>
<Endpoints>
<InputEndpoint name="HttpIn" protocol="http" port="80" />
<InputEndpoint name="HttpsIn" protocol="https" port="443" certificate="certificateName" />
</Endpoints>
<Certificates>
<Certificate name="certificateName" storeLocation="LocalMachine" storeName="My" />
</Certificates>
<Runtime>
<Environment>
<Variable name="PORT">
<RoleInstanceValue xpath="/RoleEnvironment/CurrentInstance/Endpoints/Endpoint[#name='HttpIn']/#port" />
</Variable>
<Variable name="EMULATED">
<RoleInstanceValue xpath="/RoleEnvironment/Deployment/#emulated" />
</Variable>
</Environment>
<EntryPoint>
<ProgramEntryPoint commandLine="node.cmd .\server.js" setReadyOnProcessStart="true" />
</EntryPoint>
</Runtime>
</WorkerRole>
</ServiceDefinition>
I have also tried various variations on these (with fewer extra tags and attributes) and nothing seems to work.
The protocol values you provided are HttpIn and HttpsIn. You shall use these values only for ASP.NET Web Roles!! When you run 3rd party web servers on Worker Roles you shall only use tcp as value for protocol attribute!! changing this is the easiest way to make things not working! Could you switch them back to tcp, remove the certificate attribute from the Https Endpoint and try again?
Also, the default sample app server.js listens to only one port. Which is being passed by the environment value PORT defined for the startup task. There you shall reference the HttpsIn endpoint if you want HTTPS traffic. Unfortunately I don't know whether node.js can handle both http AND https traffic with this simple setup.
UPDATE
Please use the following .csconfig file (replace the content of all .csconfig files you see in the folder with the content I provide):
<?xml version="1.0" encoding="utf-8"?>
<ServiceDefinition xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="*removed*" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceDefinition">
<WorkerRole name="WorkerRole1" vmsize="ExtraSmall">
<Startup>
<Task commandLine="setup_worker.cmd > log.txt" executionContext="elevated">
<Environment>
<Variable name="EMULATED">
<RoleInstanceValue xpath="/RoleEnvironment/Deployment/#emulated" />
</Variable>
<Variable name="RUNTIMEID" value="node" />
<Variable name="RUNTIMEURL" value="http://az413943.vo.msecnd.net/node/0.8.4.exe" />
</Environment>
</Task>
<Task commandLine="node.cmd .\startup.js" executionContext="elevated" />
</Startup>
<Endpoints>
<InputEndpoint name="HttpsIn" protocol="https" port="443" />
</Endpoints>
<Certificates>
<Certificate name="certificateName" storeLocation="LocalMachine" storeName="My" />
</Certificates>
<Runtime>
<Environment>
<Variable name="PORT">
<RoleInstanceValue xpath="/RoleEnvironment/CurrentInstance/Endpoints/Endpoint[#name='HttpsIn']/#port" />
</Variable>
<Variable name="EMULATED">
<RoleInstanceValue xpath="/RoleEnvironment/Deployment/#emulated" />
</Variable>
</Environment>
<EntryPoint>
<ProgramEntryPoint commandLine="node.cmd .\server.js" setReadyOnProcessStart="true" />
</EntryPoint>
</Runtime>
</WorkerRole>
</ServiceDefinition>
Also, please provide the code in your server.js file - at least the first 10 lines where the binding is done. And also after the changes, please execute the following command line and tell us what is the result:
c:>telnet [your_cloud_service].cloudapp.net 443
And also please confirm that you have the .pfx file in the folder where you are executing the powershell commands.
I have installed Cruise Control 1.5 on my machine and trying to configure the automated build. Everything is working fine. Application is building, i receive an email but I don't see the FXCop result embedded in the Build Email. What am i missing?
ccnet.config file
<cruisecontrol xmlns:cb="urn:ccnet.config.builder">
<project name="SampleProject">
<webURL>http://localhost/ccnet</webURL>
<workingDirectory>E:\\NewProject\\DevBuilds</workingDirectory>
<artifactDirectory>E:\\NewProject\\DevBuilds\Artifacts</artifactDirectory>
<modificationDelaySeconds>600</modificationDelaySeconds>
<category>Dev Build</category>
<sourcecontrol type="svn">
<trunkUrl>https://mycompany.com/svn/trunk/MyApplication</trunkUrl>
<workingDirectory>E:\\NewProject\\DevBuilds\SourceCode</workingDirectory>
<autoGetSource>false</autoGetSource>
<executable>C:\Program Files\Subversion\bin\svn.exe</executable>
<username>username</username>
<password>password</password>
</sourcecontrol>
<initialState>Started</initialState>
<startupMode>UseInitialState</startupMode>
<triggers>
<intervalTrigger seconds="3600" buildCondition="IfModificationExists" />
</triggers>
<state type="state" directory="E:\\NewProject\\DevBuilds" />
<labeller type="iterationlabeller">
<prefix>1.0</prefix>
<duration>1</duration>
<releaseStartDate>2012/04/11</releaseStartDate>
<separator>.</separator>
</labeller>
<tasks>
<nant>
<executable>E:\NewProject\Installables\nant\bin\nant.exe</executable>
<baseDirectory>E:\\NewProject\\Build Files</baseDirectory>
<buildFile>Build.xml</buildFile>
<targetList>
<target>Run</target>
</targetList>
<buildTimeoutSeconds>5000</buildTimeoutSeconds>
</nant>
</tasks>
<publishers>
<merge>
<files>
<file>E:\NewProject\DevBuilds\FxCopOutput\FxCop-results.xml</file>
</files>
</merge>
<xmllogger logDir="E:\\NewProject\\DevBuilds\Artifacts\\buildlogs" />
<email from="Checkins#symphonysv.com" mailhost="smtp.gmail.com" includeDetails="true" useSSL="false">
<users>
<user name="dev1" group="buildmaster" address="myname#gmail.com"/>
</users>
<groups>
<group name="buildmaster">
<notifications>
<notificationType>Always</notificationType>
</notifications>
</group>
</groups>
</email>
</publishers>
</project>
</cruisecontrol>
Build.xml
<?xml version="1.0"?>
<project name="Test" default="Run" basedir=".">
<property name="BuildNumber" value="1.0.0.0"/>
<property name="SourceControlURL" value="https://mycompany.com/svn/trunk/MyApplication/"/>
<property name="BuildFile" value=".\Build.xml"/>
<property name="TagBuild" value="false"/>
<property name="BuildType" value="Release"/>
<property name="BuildTargetDir" value="E:\NewProject\DevBuilds\Executables"/>
<property name="BuildWorkDir" value="E:\NewProject\DevBuilds\SourceCode"/>
<property name="MSBUILD" value="C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319"/>
<property name="FxCopOutPutDirectory" value="E:\NewProject\DevBuilds\FxCopOutput" />
<property name="FxCopInputDirectory" value="E:\NewProject\DevBuilds" />
<target name="Run" description="Starting ThinkPets Build">
<call target="GetLatestCode"/>
<call target="BuildCode"/>
<call target="BuildASPWebSite"/>
<call target="runFxCop"/>
</target>
<target name="GetLatestCode">
<echo message="Updating Code From SVN to ${BuildWorkDir}"/>
<exec program="svn.exe">
<arg line="checkout ${SourceControlURL} ${BuildWorkDir} -q"/>
</exec>
</target>
<target name="BuildCode">
<echo message="Building VS10 Projects Web" />
<exec program="${MSBUILD}\msbuild.exe" failonerror="true">
<arg line=" "${BuildWorkDir}\Application.sln" /t:Rebuild /p:Configuration=Release /V:q"/>
</exec>
</target>
<target name="BuildASPWebSite">
<echo message="Building ASP Web Site" />
<exec program="${MSBUILD}\aspnet_compiler.exe" failonerror="true">
<arg line=" -v / -p "${BuildWorkDir}\MyDir" -f -c "${BuildTargetDir}" "/>
</exec>
</target>
<target name="runFxCop" depends="BuildCode">
<exec program="C:\Program Files\Microsoft FxCop 1.36\FxCopCmd.exe" failonerror="false">
<arg line="/p:${FxCopInputDirectory}\SampleProject.FxCop /o:${FxCopOutPutDirectory}\FxCop-results.xml"/>
</exec>
</target>
</project>
There are a few points you missed:
You need to add <includeDetails>true</includeDetails> to your e-mail publisher block. This will give you HTML e-mails.
In order to transform your XML build results into HTML you need to add an <xslFiles> section to your e-mail publisher block. The elements of this block point to XSL transformation files in [CCNET_INSTALL_DIR]\server\xsl.
So for including the FxCop summary just as appears in CCNET webdasboard this is your e-mail publisher block:
<email from="Checkins#symphonysv.com" mailhost="smtp.gmail.com" includeDetails="true" useSSL="false">
<users>
<user name="dev1" group="buildmaster" address="myname#gmail.com"/>
</users>
<groups>
<group name="buildmaster">
<notifications>
<notificationType>Always</notificationType>
</notifications>
</group>
</groups>
<includeDetails>true</includeDetails>
<xslFiles>
<file>xsl\fxcop-summary_1_36.xsl</file>
</xslFiles>
</email>
Thanks Chairman for your valuable time. I think my mistake was that I did not host the "ccnet" application on my machine which resulted in not able to find the xsls for the publishers. When I used the same settings and config file on the Server machine with "ccnet" application hosted, I was able to see the FxCop summary in the email. Please correct my understanding if wrong.