关键字不支持:“DSN” [英] Keyword not supported: 'dsn'
问题描述
我想发表我的网站远程服务器上。我的托管服务提供商已经走过dotnetpanel提供我与DSN连接。当我发表我的地盘我得到的错误,如图截图。我也包括我的web.config文件。
我的web.config有:
<?XML版本=1.0编码=UTF-8&GT?;
<! -
注意:作为一种替代手工编辑这个文件,你可以使用
Web管理工具来配置应用程序的设置。使用
该网站 - >在Visual Studio中Asp.Net配置选项。
设置和注释的完整列表中可以找到
machine.config.comments通常位于
\\ WINDOWS \\ Microsoft.Net \\框架\\ V2.X \\配置
- >
<结构> <&的appSettings GT;
<添加键=myDSNVALUE =evodsn/>
< /的appSettings>
<&是connectionStrings GT;
<添加名称=evocon的connectionString =DSN = myDSN; /> < /&是connectionStrings GT; < system.net>
< mailSettings>
<&SMTP GT;
<网络主机=smtp.gmail.com/>
< / SMTP>
< / mailSettings>
< /system.net>
<&的System.Web GT;
<! -
集编译调试=true以将调试
符号插入到编译页。因为这
影响性能,因此将该值设置为唯一的真
在开发过程中。
- >
<&HttpHandlers的GT;
<! - <添加动词=POST,GET,HEAD路径=elmah.axdTYPE =Elmah.ErrorLogPageFactory,ELMAH/> - >
<添加动词=*路径=TinyMCEHandler.aspxTYPE =莫邪code.TinyMCE.Web.HttpHandler,莫邪code.TinyMCE验证=FALSE/>
<* MVC添加动词=*路径=验证=假TYPE =System.Web.Mvc.MvcHttpHandler,System.Web.Mvc,版本= 2.0.0.0,文化=中性公钥= 31BF3856AD364E35 />
<添加路径=WebResource.axd的动词=GETTYPE =System.Web.Handlers.AssemblyResourceLoader验证=真正的/>
< / HttpHandlers的> <的httpRuntime requestValidationMode =2.0/> <编译调试=真targetFramework =4.0>
<&集会GT;
<添加组件=System.Web.Mvc,版本= 2.0.0.0,文化=中性公钥= 31BF3856AD364E35/>
<添加组件=System.Web.Abstractions,版本= 4.0.0.0,文化=中性公钥= 31BF3856AD364E35/>
<添加组件=System.Web.Routing,版本= 4.0.0.0,文化=中性公钥= 31BF3856AD364E35/>
<添加组件=System.Data.Linq程序,版本= 4.0.0.0,文化=中性公钥= B77A5C561934E089/>
<添加组件=System.Design,版本= 4.0.0.0,文化=中性公钥= B03F5F7F11D50A3A/>< /组件>
< /编译>
<! -
在<身份验证和GT;节可以配置
所使用的安全性的认证模式的
ASP.NET识别传入的用户。
- >
<全球化的UICulture =EN文化=EN-GB/>
<身份验证模式=表格>
<形式loginUrl =〜/ Account.mvc /指数超时=2880保护=全部/>
< /认证>
<会员defaultProvider =evocon>
<供应商>
<清/> <添加
NAME =evocon
键入=System.Web.Security.SqlMembershipProvider,System.Web程序,版本= 2.0.0.0,文化=中性公钥= b03f5f7f11d50a3a
的connectionStringName =evocon
enablePasswordRetrieval =假
enablePasswordReset设置=真
requiresQuestionAndAnswer =假
/>
< /供应商>
< /会员>
<型材>
<供应商>
<清/>
<添加名称=AspNetSqlProfileProviderTYPE =System.Web.Profile.SqlProfileProvider,System.Web程序,版本= 2.0.0.0,文化=中性公钥= b03f5f7f11d50a3a的connectionStringName =ApplicationServices的applicationName =//>
< /供应商>
< / profile文件>
< roleManager启用=false的>
<供应商>
<清/>
<添加的connectionStringName =ApplicationServices的applicationName =/NAME =AspNetSqlRoleProviderTYPE =System.Web.Security.SqlRoleProvider,System.Web程序,版本= 2.0.0.0,文化=中性公钥= b03f5f7f11d50a3a/>
<添加的applicationName =/NAME =AspNetWindowsTokenRoleProviderTYPE =System.Web.Security.WindowsTokenRoleProvider,System.Web程序,版本= 2.0.0.0,文化=中性公钥= b03f5f7f11d50a3a/>
< /供应商>
< / roleManager>
<! -
在<&的customErrors GT;节可以配置
的什么,如果/当发生未处理的错误做
一个请求的执行过程中。特别,
它允许开发人员配置HTML错误页
要显示代替错误堆栈跟踪.--> <的customErrors模式=关>
<错误状态code =403重定向=NoAccess.htm/>
<错误状态code =404重定向=FileNotFound.htm/>
< /&的customErrors GT; <页面controlRenderingCompatibilityVersion =3.5的ClientIDMode =自动识别>
<&命名空间GT;
<添加命名空间=System.Web.Mvc/>
<添加命名空间=System.Web.Mvc.Ajax/>
<添加命名空间=System.Web.Mvc.Html/>
<添加命名空间=System.Web.Routing/>
<添加命名空间=System.Linq的/>
<添加命名空间=System.Collections.Generic/>
<添加命名空间=Telerik.Web.Mvc.UI/>
< /命名空间>
< /页> < /system.web>
<! -
的system.webServer部分需要在Internet上运行ASP.NET AJAX
信息服务7.0。这是没有必要的IIS的previous版本。
- >
< system.webServer>
<验证validateIntegratedModeConfiguration =FALSE/>
<模块runAllManagedModulesForAllRequests =真正的>
< /模块>
<&处理GT;
<清除NAME =MvcHttpHandler/>
<清除NAME =UrlRoutingHandler/>
<添加名称=MvcHttpHandlerpreCondition =integratedMode动词=*路径= TYPE =System.Web.Mvc.MvcHttpHandler,System.Web.Mvc,版本= 2.0.0.0* MVC。文化=中性公钥= 31BF3856AD364E35/>
< /处理器>
< directoryBrowse启用=FALSE/>
< defaultDocument>
<&文件GT;
<清/>
<增加价值=Default.aspx的/>
<增加价值=Default.asp的/>
<增加价值=如default.php/>
<增加价值=Default.htm的/>
<增加价值=default.html中/>
<增加价值=Index.aspx的/>
<增加价值=的index.asp/>
<增加价值=的index.php/>
<增加价值=index.htm的/>
<增加价值=的index.html/>
<增加价值=parking.htm/>
< /文件>
< / defaultDocument>
< /system.webServer>
<&运行GT;
< assemblyBinding的xmlns =瓮:架构 - 微软COM:asm.v1>
< dependentAssembly>
< assemblyIdentity名称=System.Web.Mvc公钥=31bf3856ad364e35/>
< bindingRedirect oldVersion =1.0.0.0NEWVERSION =2.0.0.0/>
< / dependentAssembly>
< / assemblyBinding>
< /运行> <位置路径=App_Data文件有的allowOverride =false的>
<&的System.Web GT;
<授权>
<让用户=? />
< /授权>
< /system.web>
< /地点>
< /结构>
从堆栈跟踪它看起来像你正在使用SqlClient.SqlConnection对象时,却DSN是ODBC连接。
您要么改变你的connectioin字符串使用SQL Server连接字符串或更改连接对象在code至ODBCConnection。
I am trying to publish my site on remote server. My hosting provider has provided my with dsn connectivity through dotnetpanel. When i publish my site i get the error as shown in screenshot. I have also included my web.config file.
My web.config is as follows,
<?xml version="1.0" encoding="UTF-8"?>
<!--
Note: As an alternative to hand editing this file you can use the
web admin tool to configure settings for your application. Use
the Website->Asp.Net Configuration option in Visual Studio.
A full list of settings and comments can be found in
machine.config.comments usually located in
\Windows\Microsoft.Net\Framework\v2.x\Config
-->
<configuration>
<appSettings>
<add key="myDSN" value="evodsn"/>
</appSettings>
<connectionStrings>
<add name="evocon" connectionString="DSN=myDSN;" />
</connectionStrings>
<system.net>
<mailSettings>
<smtp>
<network host="smtp.gmail.com" />
</smtp>
</mailSettings>
</system.net>
<system.web>
<!--
Set compilation debug="true" to insert debugging
symbols into the compiled page. Because this
affects performance, set this value to true only
during development.
-->
<httpHandlers>
<!--<add verb="POST,GET,HEAD" path="elmah.axd" type="Elmah.ErrorLogPageFactory, Elmah"/>-->
<add verb="*" path="TinyMCEHandler.aspx" type="Moxiecode.TinyMCE.Web.HttpHandler, Moxiecode.TinyMCE" validate="false" />
<add verb="*" path="*.mvc" validate="false" type="System.Web.Mvc.MvcHttpHandler, System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add path="WebResource.axd" verb="GET" type="System.Web.Handlers.AssemblyResourceLoader" validate="true" />
</httpHandlers>
<httpRuntime requestValidationMode="2.0" />
<compilation debug="true" targetFramework="4.0">
<assemblies>
<add assembly="System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add assembly="System.Web.Abstractions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add assembly="System.Web.Routing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add assembly="System.Data.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
<add assembly="System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" /></assemblies>
</compilation>
<!--
The <authentication> section enables configuration
of the security authentication mode used by
ASP.NET to identify an incoming user.
-->
<globalization uiCulture="en" culture="en-GB" />
<authentication mode="Forms">
<forms loginUrl="~/Account.mvc/index" timeout="2880" protection="All" />
</authentication>
<membership defaultProvider="evocon">
<providers>
<clear />
<add
name="evocon"
type="System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
connectionStringName="evocon"
enablePasswordRetrieval="false"
enablePasswordReset="true"
requiresQuestionAndAnswer="false"
/>
</providers>
</membership>
<profile>
<providers>
<clear />
<add name="AspNetSqlProfileProvider" type="System.Web.Profile.SqlProfileProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" connectionStringName="ApplicationServices" applicationName="/" />
</providers>
</profile>
<roleManager enabled="false">
<providers>
<clear />
<add connectionStringName="ApplicationServices" applicationName="/" name="AspNetSqlRoleProvider" type="System.Web.Security.SqlRoleProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<add applicationName="/" name="AspNetWindowsTokenRoleProvider" type="System.Web.Security.WindowsTokenRoleProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
</providers>
</roleManager>
<!--
The <customErrors> section enables configuration
of what to do if/when an unhandled error occurs
during the execution of a request. Specifically,
it enables developers to configure html error pages
to be displayed in place of a error stack trace.-->
<customErrors mode="Off">
<error statusCode="403" redirect="NoAccess.htm"/>
<error statusCode="404" redirect="FileNotFound.htm"/>
</customErrors>
<pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID">
<namespaces>
<add namespace="System.Web.Mvc" />
<add namespace="System.Web.Mvc.Ajax" />
<add namespace="System.Web.Mvc.Html" />
<add namespace="System.Web.Routing" />
<add namespace="System.Linq" />
<add namespace="System.Collections.Generic" />
<add namespace="Telerik.Web.Mvc.UI" />
</namespaces>
</pages>
</system.web>
<!--
The system.webServer section is required for running ASP.NET AJAX under Internet
Information Services 7.0. It is not necessary for previous version of IIS.
-->
<system.webServer>
<validation validateIntegratedModeConfiguration="false" />
<modules runAllManagedModulesForAllRequests="true">
</modules>
<handlers>
<remove name="MvcHttpHandler" />
<remove name="UrlRoutingHandler" />
<add name="MvcHttpHandler" preCondition="integratedMode" verb="*" path="*.mvc" type="System.Web.Mvc.MvcHttpHandler, System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
</handlers>
<directoryBrowse enabled="false" />
<defaultDocument>
<files>
<clear />
<add value="Default.aspx" />
<add value="Default.asp" />
<add value="Default.php" />
<add value="Default.htm" />
<add value="Default.html" />
<add value="Index.aspx" />
<add value="Index.asp" />
<add value="Index.php" />
<add value="Index.htm" />
<add value="Index.html" />
<add value="parking.htm" />
</files>
</defaultDocument>
</system.webServer>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0" newVersion="2.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
<location path="App_Data" allowOverride="false">
<system.web>
<authorization>
<allow users="?" />
</authorization>
</system.web>
</location>
</configuration>
From the Stack Trace it looks like you are using a SqlClient.SqlConnection object, but DSN is for ODBC connections.
You either change your connectioin string to use a Sql Server Connection String or change the connection object in your code to ODBCConnection.
这篇关于关键字不支持:“DSN”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!