के लिए कनेक्शन स्ट्रिंगनाम यहां मेरी nlog.config फ़ाइल है। मैंने फेंकता अपवाद चालू कर दिया है।nlog डेटाबेस लॉगिंग
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" throwExceptions="true">
<targets>
<target type="Database" name="databaseLog"
dbProvider="sqlserver" connectionstring="server=.\SQLExpress;database=Movie;integrated security=true">
<commandText>
INSERT INTO [Log] ([Description] , [Level]) VALUES (@Description, @Level)
</commandText>
<parameter name="@Description" layout="${message}"/>
<parameter name="@Level" layout="${level}"/>
</target>
</targets>
<rules>
<logger name="*" minLevel="Trace" appendTo="databaseLog"/>
</rules>
</nlog>
यह काम करेंगे और डेटाबेस में रिकॉर्ड दर्ज हो जाएगा। हालांकि मैं कनेक्शनस्ट्रिंगनाम का उपयोग करना चाहता हूं और कनेक्शनस्ट्रिंग को फिर से टाइप नहीं करना चाहता हूं। जब मैं connectionstring को connectionstringname इस तरह ....
connectionstring="server=.\SQLExpress;database=Movie;integrated security=true"
connectionStringName="ApplicationConnectionString"
करने के लिए बदल रहा 'providerInvariantName के लिए गैर रिक्त स्ट्रिंग की उम्मीद एक त्रुटि मिल 'पैरामीटर
धन्यवाद निक! महान काम करता है – eiu165
क्या आप कृपया स्पष्टीकरण दे सकते हैं कि यह nLog config या web.config कहां जाता है? धन्यवाद। – AlexVPerl