web service中不能访问web.config文件的问题!
Public Function GetAdoHelper() As AdoHelper
Dim [assembly] As String '= Nothing
Dim type As String = Nothing
[assembly] = ConfigurationSettings.AppSettings("SqlServerHelperAssembly")
type = ConfigurationSettings.AppSettings("SqlServerHelperType")
Return AdoHelper.CreateHelper([assembly], type)
End Function 'GetAdoHelper
在web.config中设置好后,上面的语句总是出现问题,断点跟踪发现[assembly]和type的值均为nothing,但web.config文件是完全没有问题的。偶然看Applied Microsoft .Net Framework Programming这本书,看到上面写到:“对于Asp.net Web窗体和XML Web服务应用程序,配置文件必须位于Web应用程序的虚拟根目录下,并且名称总是Web.Config。”按上面说的做了,Ok了。下面是前后文件列表的路径截图:
原路径文件列表截图:
新路径文件列表图(拷贝web.config文件后):

浙公网安备 33010602011771号