Error message 1
Object reference is not set to an instance of the object.
[Problem Analysis]: Open the App.config file, check the string in the name node and the current brackets is the same, the comparison found, not the same, more than one S. Remember, C# reads the name in brackets used in the node, and the configuration file node configuration name must be consistent!
[problem-solving] remove “s” and run it.
[other Error] 1: some friends don’t pay attention to this situation that you add spaces in the string will also lead to this problem, such as the following:
Spaces must be removed. You cannot add any spaces in the configuration file.
[other Error] 2: if the node position is written incorrectly, the above error will also occur. For example, in the screenshot below, the node should be written to the arrow position.
[other Error] 3: If the App.config configuration file is not added, or the App.config file is not placed in the project launchable project directory, the above error will also occur. For example, the following is wrong:
The following green part is the project’s startable items, App.config file must be put here to work.
[Other Error] 4: modified the name of the configuration file, the configuration file requirements must be the default App.config to work, if you modify the file name, there will also be errors, such as the following is not allowed: the case of.
Error message 2
The type initial value setting item of “ThreeLayer.DAL.SQLHelper” raises an exception.
The problem is that as long as the prompt “SQLHelper’s type initial setting item raises an exception”. Generally, it is a configuration file problem, because we use App.config configuration file to save the data connection string. For beginners, because they can’t understand this error, so they don’t know where to start, here please remember the following troubleshooting methods.
[Solution 1] The configuration file node is written wrong
Originally this place node name is also the above is less than an s, change to the following can be: [Solution 2] configuration file App.config file if you change the name, not placed in the “startable project” root directory.
[Solution 2] configuration file App.config file if the name is modified, not put into the “startable project” root directory, some VS versions will also appear the above error. (This is the same as the solution to error 1)
According to the above method, you can perfectly solve the common problem of getting the connection string through App.config. I hope today’s content can help you.
- Git: “error: RPC failed; curl 18 transfer closed with outstanding read data remaining”
- [Solved] Ubuntu 20.04 LTS Install k8s Error: The connection to the server localhost:8080 was refused
- Template Render Error Solution (Hexo blog theme, GIT upload)
- Analysis of npm error ENOTFOUND npm ERR! network request to https://npm.***.com/*** failed and the role of the .npmrc file
- [Solved] Postcss Error: Invalid options object. PostCSS Loader has been initialized using an options object that does not match the API schema.
- [Solved] Git Clone Error: error setting certificate verify locations
- [Solved] K8s Error: ERROR: Unable to access datastore to query node configuration
- How to Solve Clickhouse restart error: Cannot obtain value of path from config file…
- IDEA: How to Solve spark source code Modified Error
- Flutter upgrade upgrade SDK SSL_ERROR_Syscall error [How to Solve]
- How to Solve elasticSearch8.1.2 Install Error in Win10
- [Solved] React import the Path of Image error: cannot find mouse ‘.‘
- [Solved] Android Error: AAPT: error: unescaped apostrophe in string；Multiple substitutions specified in non-positi
- [Solved] Found bindings for the following environments
- [Solved] Redis Startup Error: FATAL CONFIG FILE ERROR
- How to Solve Webpack CacheGroups Error
- flutter, Unable to buy item, Error response code: 7 & flutter_inapp_purchase
- Hexo Error: error: spawn failed [How to Solve]
- Rabbitmq: Erlang distribution failed solution
- [Solved] Error: Message failed: 554 5.2.0 STOREDRV.Submission.Exception:OutboundSpamException;